Online Payments
offers various options for collecting one-time, online payments:
- API-only: Build a custom payment flow using the Payment IntentsAPI.
- Checkout sessions: Low-code option for partners to generate
checkout_session_url
that routes the customer to a -hosted payments page. - Payment links: No-code option for merchants to generate a unique payment link from the Dashboard that routes the customer to a -hosted payments page.
To determine which option is best for you, review our payment integration options.
Collect an Online Payment
Asynchronous payment flows are complex to manage because they depend on customer interactions that happen outside of your application. Payment IntentsAPI simplify this by tracking the payment status, serving as the source of truth throughout the payment lifecycle.
Create a payment intent
To Create a Payment IntentAPI, specify the necessary details such as currency, payment method, and amount.
curl -L '{{PRODUCTION_API_URL}}/v1/payment-intents' \
-H '{{ACCOUNT_HEADER}}-account: {{MERCHANT_ACCOUNT_ID}}' \
-H 'Content-Type: application/json' \
-H '{{ACCOUNT_HEADER}}-api-key: {{SECRET_KEY}}' \
-d '{
"amount": 1000,
"currency": "usd",
"payment_method_types": [
"card"
],
"confirm": true,
"payment_method_id": "{{PAYMENT_METHOD_ID}}"
}'
Best practices when creating a payment intent
- Create a Payment IntentAPI at the beginning of the checkout process, once you know the total amount. If the amount changes, you can Update a Payment IntentAPI as needed.
- If the checkout process is interrupted and later resumed, reuse the existing payment intent instead of creating a new one. Reusing the payment intent helps in monitoring any failed payment attempts and keeps the transaction history organized for each cart or session.
Confirm the payment
In order to confirm a payment intent, the payment method details or a payment_method_id
must be specified. You can confirm at creation by setting confirm=true
in the request body.
If the payment intent status is requires_payment_method
, you'll need to attach a payment method using the Confirm a Payment IntentAPI endpoint.
curl -L '{{PRODUCTION_API_URL}}/v1/payment-intents/{{PAYMENT_INTENT_ID}}/confirm' \
-H '{{ACCOUNT_HEADER}}-account: {{MERCHANT_ACCOUNT_ID}}' \
-H 'Content-Type: application/json' \
-H '{{ACCOUNT_HEADER}}-api-key: {{SECRET_KEY}}' \
-d '{
"payment_method_id": "{{PAYMENT_METHOD_ID}}"
}'
Payment Intent States
STATUS | DESCRIPTION | ADDITIONAL INFORMATION |
---|---|---|
requires_payment_method | Payment requires a payment method | If a payment attempt fails, it reverts to this status. |
requires_confirmation | Payment method has been provided but the payment requires confirmation | This status is set after the customer provides payment information and before the payment intent is confirmed. Often bypassed in integrations where payment information and confirmation occur simultaneously. |
requires_capture | Payment has been authorized but not captured | Used when authorization and capture are separate actions. |
requires_action | Payment requires additional action | For example, action needs to be taken on the terminal reader to complete the payment. |
processing | Payment is processing | Processing time varies by payment method. |
succeeded | Payment has succeeded | A ChargeAPI object has been created and funds are in the merchant’s account. If several payment attempts were made, several charges would exist. |
canceled | Payment has been canceled | A payment intent can be canceled before it reaches processing or succeeded status, making it invalid for future attempts. This action is irreversible. Any held funds will be reversed. |
FAQ
What payment methods are supported?
Card, bank-to-bank, and Apple Pay are supported for online payments. HSA/FSA cards are not supported at this time.What card brands are supported?
Visa, Mastercard, Discover, and Amex are supported, with Maestro, Diners, and JCB also available with Paysafe.What is the difference between a payment intent and a charge?
A payment intent represents the entire lifecycle of a payment, from initiation to completion or cancellation. In contrast, charges occur at a singular point in the payment process when a transfer of funds is initiated.Is it possible to perform more than one capture with the same payment intent?
No, a payment intent can only be captured once, even if the captured amount is less than the authorized amount.What are platform fees and how are they used?
Partners processing online payments through Paysafe can specify a platform_fee
amount when Creating a Payment IntentAPI. This fee is deducted from the total payment amount and directed to the partner, serving as a per-transaction service fee. The platform_fee
cannot exceed the total payment amount minus processing fees.
For example, if a customer makes a $10 payment to a merchant with a $1.00 platform fee, the merchant would receive $9.00, while the partner collects $1.00 as the service fee.
Common use cases for platform fees include:
- Passing on the merchant's processing cost to the customer, also known as surcharging
- Billing for service or SaaS fees
- Enabling tipping and donations