PapelPay must be active on your store. Apply for it in the dashboard under PapelPay; the endpoints on this page return
PAPELPAY_NOT_ENABLED until your store is approved.How a card payment works
1
Create the order
Call
POST /api/v1/invoices with the customer and the products, as in Create and manage orders. Add auto_renew to sell a subscription product as a subscription or as a one-time purchase. See Subscriptions.2
Start the card payment
Call
POST /api/v1/invoices/{invoiceId}/papelpay, or send "payment_method": "PAPELPAY" when you create the order to do both in one call. The response contains a payment object.3
Let the customer pay
Send the customer to
payment.payment_url, your hosted checkout opened on the card form. To keep the customer on your site, mount payment.embed_url with the JavaScript SDK. See Card form on your site.4
Confirm the order
When the card is charged, the order becomes
completed and PapelShip delivers the products. Listen for the order.completed webhook, or read the order with GET /api/v1/invoices/{invoiceId}. See Webhooks.Start the card payment
Response (200)
Calling the endpoint again while the payment is open returns the same
session_id. Use the order ID in your Idempotency-Key.
The payment object
Errors
When you send
"payment_method": "PAPELPAY" on create and the card payment can’t start, the order still exists. The error’s details.invoice_id names it, so you can retry with POST /invoices/{invoiceId}/papelpay.
Next steps
Subscriptions
Sell a product as a subscription and follow its renewals.
Card form on your site
Show the card form on your own checkout page.