Palbase Payments · API
/payments/customers/{customer_id}/adoptBring over a customer the provider already has
Brings over a customer the channel's provider already has — made on the provider's own account before the project billed through Palbase — as the payer's record on the channel: its cards are listed as the payer's, the card named by default_method (else the one the provider charges the customer's invoices to, else the oldest) is the payer's default, and a payer with no profile here takes the record's name, email, address and tax number, keeping the buyer's address its server named (ip), if any (one with a profile keeps it, and it is written on the record). Nothing is charged, and nobody enters a card again; each card brought over is told as payments.method.saved. The provider's customer is marked the payer's and the project's (Stripe: its palbase_customer and palbase_project metadata): another project on the same provider account is refused it. Subscriptions the customer has at the provider are not brought over: they go on renewing there. Nor is what the customer paid at the provider before: a dispute or a refund of a charge made there before the adoption is not told (payments.dispute.opened, payments.refund.succeeded): Payments tells of the payments it made, and those stay the provider's to answer. Asked again for the same customer it answers the payer as it is. A refused adoption keeps nothing, the payer included. 404 provider_customer_not_found for a customer the channel's provider account does not have (one of another account, or of the other mode); 409 provider_customer_deleted for one the provider deleted; 409 provider_customer_taken for one that is another payer's record; 409 customer_has_provider_record for a payer that has a record of its own on the channel already; 422 default_method_not_found for a default_method that is none of the customer's cards; 422 adopt_not_supported on a channel whose provider keeps no customer record (iyzico); 412 no_payment_channel for no active channel of that key; 503 provider_unavailable when the provider could not be reached (asking again is safe).
Called by your server, with the project's secret key.
Path
customer_idstring · requiredThe payer's id: a user id, or any name of 1 to 128 characters the project's server gives a company or a team. Escape it as a path segment.Request body
channelstring · requiredThe channel whose provider account holds the customer.provider_customerstring · requiredThe provider's id of the customer (Stripe: cus_…).default_methodstring · optionalThe provider's id of one of the customer's cards (Stripe: pm_…) that becomes the payer's default on the channel. Left out: the card the provider charges the customer's invoices to by default, else the oldest card.curl -X POST "https://<your-ref>.palbase.studio/payments/customers/<customer_id>/adopt" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"channel":"string","provider_customer":"string"}'Responses
200OK
defaultStandard Palbase JSON error envelope (`error` and `error_description`).
Operation AdoptCustomer of payments's contract.