Before you start
- Start the card payment on your server with
POST /api/v1/invoices/{invoiceId}/papelpayand passpayment.embed_urlto your page. See Overview. - Add the domain of your checkout page in the dashboard under PapelPay > Domains and verify it. A verified custom domain of your store works too, and so do its subdomains.
localhostand127.0.0.1work without setup while you develop.
Mount the form
checkout.html
mount returns { iframe, destroy }; call card.destroy() to remove the form, for example when the customer picks another payment method.
Options
Events
The same events are available globally with
PapelShip.on("papelpay:paid", fn), papelpay:declined, papelpay:error and papelpay:ready, and as papelship:papelpay:paid (and so on) CustomEvents on window.
Confirm the payment on your server
onPaid tells your page that the card was charged. Before you deliver anything yourself, confirm the order on your server: wait for the order.completed webhook or read GET /api/v1/invoices/{invoiceId} and check that status is completed. See Webhooks.