Prepare a checkout payment
const url = 'https://apisandbox.puurk.com/checkout/prepare';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"amount":25000,"oid":"example","client_id":"example","uid":"example","customer_name":"example","customer_email":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://apisandbox.puurk.com/checkout/prepare \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "amount": 25000, "oid": "example", "client_id": "example", "uid": "example", "customer_name": "example", "customer_email": "example" }'Creates a Stripe PaymentIntent and returns the client secret and publishable key needed to collect a card with Stripe Elements. Used by the Puurk hosted checkout and by partners using Puurk as their payment processor.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Payment intent to prepare
object
Amount to charge, in cents. Must not exceed 10000000.
Example
25000Organization ID the payment belongs to
Your own identifier for the customer. Resolves an existing payment customer for this organization, or creates one keyed on it. Without a client_id the organization’s shared anonymous payment customer is used, so every customer’s saved cards land on the same Stripe customer — always send one.
Puurk user ID of the customer. Rejected for service-token callers, which must use client_id.
Customer name, used when creating a new payment customer
Customer email. Required when neither client_id nor uid is supplied.
Responses
Section titled “Responses”Successful operation
object
PaymentIntent client secret, for Stripe Elements
Puurk’s Stripe publishable key, for initializing Stripe.js
Stripe PaymentIntent ID
Stripe ephemeral key for the customer
Stripe customer ID
Reserved Puurk payment ID, to pass to /checkout/verify-payment
Examplegenerated
{ "client_secret": "example", "publishable_key": "example", "payment_intent_id": "example", "customer_ephemeral_key": "example", "customer_id": "example", "payment_id": "example"}Invalid parameter
Unauthorized
Unable to process request