The general flow
Creating a Payment Intent usually goes like this:- Say how much the customer needs to pay.
- Optionally, add more details, who the customer is, which payment methods to allow, and where to send them afterward.
- Get back a link to the payment page, where the customer pays.
Different ways to create a Payment Intent
1. Just the amount
The simplest case: all you need is the amount to charge. This is the most basic setup.- Situation: You want a customer to pay GMD 450, and you’re not adding a customer record or any other optional details.
- Request:
- Result: A Payment Intent is created, along with a link to the payment page where the customer pays.
2. Amount and customer
Here you add the customer who’s paying, on top of the amount. This ties the payment to a specific customer so it’s easier to keep track of.- Situation: You want to charge GMD 450 and link it to a particular customer.
- Request:
3. Amount, customer, and payment methods
A more specific setup: you set the amount, link a customer, and decide ahead of time which payment methods the customer can use. Handy when you want to limit things to certain methods.- Situation: You want to charge GMD 450, link it to a customer, and only allow a particular payment method.
- Request:
4. Amount, customer, and a specific saved payment method
Here you point to one of the customer’s saved payment methods by its ID. Useful when you want to charge a saved card or bank account directly.- Situation: You want to charge GMD 450, link it to a customer, and use a specific saved payment method from their account. This lets you charge a saved method straight away, which makes things quicker for returning customers.
- Request:
Common optional details
The amount is the only thing you must include. Everything else is optional, to round out the payment:- currency: The currency for the payment. If you leave it out, the default currency is used.
- title: A title for the payment.
- description: A description of the payment.
- metadata: Any extra custom information you want to attach.
- return_url: Where the customer is sent after they pay.
- cancel_url: Where the customer is sent if they cancel.
- payment_methods: A list of payment methods you’ll accept.
