Copy customer payment methods between merchants
/payment_methods/copyCopies all reusable payment methods of a customer from a source merchant to the current (destination) merchant, which is determined by the API key. A customer is created (or reused) under the destination merchant, and each payment method is re-created with the new merchant and customer IDs while keeping the original card token. The source merchant must belong to the same company as the destination merchant. When continuous_sync is true, the initial copy covers every payment method (including non-reusable and wallet types, unlike the default one-shot copy) and a persistent bidirectional sync is established; see continuous_sync for details. Use POST /payment_methods/copy/disable to remove a sync pair.
Headers
AuthorizationstringRequiredidempotency-keystringA unique key, such as a UUID, that makes a POST or DELETE request safe to retry. Pay.com keeps each key for 24 hours, separately for each workspace.
- A retry with the same key, endpoint and body gets the first request's stored status and body, without running the request again.
- If the first request is still being processed, a retry gets 409
idempotency_error(request_in_progress). - The same key on another endpoint, or with another body, gets 400
idempotency_error(invalid_parameters). - GET, PUT and PATCH requests ignore the key.
The response repeats the key in its Idempotency-Key header.
Parameters
source_merchant_idstringRequiredUnique identifier of the merchant to copy the payment methods from. Must belong to the same company as the current merchant.
customer_reference_idstringRequiredYour unique identifier for the customer created (or reused) under the destination merchant.
source_customer_reference_idstringYour unique identifier for the customer under the source merchant. Defaults to customer_reference_id when omitted.
continuous_syncbooleanWhether to establish a persistent bidirectional sync between the source and destination customers in addition to the immediate copy. When true, every subsequent payment method create, update, and delete on either customer is mirrored to the other, so both converge to exactly the same set of payment methods. A customer can participate in at most one sync pair; if either customer is already continuously synced to a different partner, the request fails with a 400 error and the existing pair must first be removed with POST /payment_methods/copy/disable. Customers created after the sync is enabled (for example, implicitly by /holds or /charges) do not sync until this endpoint is called again with their reference ID. Calling this endpoint again with continuous_sync set to true for the same pair is idempotent. Defaults to false, which keeps the one-shot copy of reusable payment methods only.
Returns
Returns the destination customer that the payment methods were copied to.
consumer_idstringUnique identifier of the customer created (or reused) under the destination merchant.
customer_reference_idstringYour unique identifier for the destination customer.
Errors
400continuous_sync request for a customer that is already continuously synced to a different destination.401invalid_key, invalid_token, legacy_keys_ended, legacy_keys_off or permission_denied).403resource_not_allowed, key_disabled, network_not_allowed, pci_required or merchant_required), or this resource isn't enabled for your account (permission_denied). code says why.404409idempotency-key is still being processed (request_in_progress). Wait, then retry with the same key.500503Retry-After, or after a few seconds when there's none.