Accept a payment with Billie
Learn how to set up your integration with Billie.
Unified line items
To maximize approval rates when you integrate with Billie, include line_
data to represent what’s in a shopper’s cart. For early access, see Payments line items.
Use the Payment Element to embed a custom Stripe payment form in your website or application and offer payment methods to customers. For advanced configurations and customizations, refer to the Accept a Payment integration guide.
Set up StripeServer-side
To get started, create a Stripe account.
Use our official libraries for access to the Stripe API from your application:
Collect payment detailsClient-side
You’re ready to collect payment details on the client with the Payment Element. The Payment Element is a prebuilt UI component that simplifies collecting payment details for a variety of payment methods.
The Payment Element contains an iframe that securely sends payment information to Stripe over an HTTPS connection. Avoid placing the Payment Element within another iframe because some payment methods require redirecting to another page for payment confirmation.
The checkout page address must start with https://
rather than http://
for your integration to work. You can test your integration without using HTTPS, but remember to enable it when you’re ready to accept live payments.
You can customize the Payment Element to match the design of your site by passing the appearance object into options
when creating the Elements
provider.
Collect addresses
By default, the Payment Element only collects the necessary billing address details. To collect a customer’s full billing address (to calculate the tax for digital goods and services, for example) or shipping address, use the Address Element.
Create a PaymentIntentServer-side
Run custom business logic immediately before payment confirmation
Navigate to step 5 in the finalize payments guide to run your custom business logic immediately before payment confirmation. Otherwise, follow the steps below for a simpler integration, which uses stripe.
on the client to both confirm the payment and handle any next actions.
Submit the payment to StripeClient-side
Use stripe.confirmPayment to complete the payment using details from the Payment Element.
Provide a return_url to this function to indicate where Stripe redirects the user after they complete the payment. Your user might be initially redirected to an intermediate site, such as a bank authorization page, before being redirected to the return_
. Card payments immediately redirect to the return_
when a payment is successful.
If you don’t want to redirect for card payments after payment completion, you can set redirect to if_
. This only redirects customers that check out with redirect-based payment methods.
OptionalHandle post-payment events
Stripe sends a payment_intent.succeeded event when the payment completes. Use the Dashboard, a custom webhook, or a partner solution to receive these events and run actions, like sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow.
Listen for these events rather than waiting on a callback from the client. On the client, the customer could close the browser window or quit the app before the callback executes, and malicious clients could manipulate the response. Setting up your integration to listen for asynchronous events also helps you accept more payment methods in the future. Learn about the differences between all supported payment methods.
Handle events manually in the Dashboard
Use the Dashboard to View your test payments in the Dashboard, send email receipts, handle payouts, or retry failed payments.
Build a custom webhook
Build a custom webhook handler to listen for events and build custom asynchronous payment flows. Test and debug your webhook integration locally with the Stripe CLI.
Integrate a prebuilt app
Handle common business events, such as automation or marketing and sales, by integrating a partner application.
OptionalSeparate authorization and capture
You can separate authorization and capture to create a charge now, but capture funds later. Stripe cancels the PaymentIntent and sends a payment_intent.canceled event if the payment isn’t captured during the 7-day window.
If you’re certain you can’t capture the payment, we recommend canceling the PaymentIntent instead of waiting for the 7-day window to elapse.
1. Tell Stripe to authorize only
To indicate that you want separate authorization and capture, set capture_method to manual
when creating the PaymentIntent. This parameter instructs Stripe to only authorize the amount on the customer’s Billie account.
2. Capture the funds
After the authorization succeeds, the PaymentIntent status transitions to requires_
. To capture the authorized funds, make a PaymentIntent capture request.
Stripe captures the total authorized amount by default. You can also specify amount_
to be less than or equal to the total.
Optional Cancel the authorization
If you need to cancel an authorization, you can cancel the PaymentIntent.
OptionalAdd line items to the PaymentIntent
Unified line items
To maximize approval rates when you integrate with Billie, include line_
data to represent what’s in a shopper’s cart. For early access, see Payments line items.
Test your integration
To test your integration, choose the payment method and tap Pay. In a sandbox, this redirects you to a test payment page where you can approve or decline the payment.
In live mode, tapping Pay redirects you to the Billie website—you don’t have the option to approve or decline the payment with Billie.
Error codes 
The following table details common error codes and recommended actions:
Error code | Recommended action |
---|---|
payment_ | Enter a supported currency. |
missing_ | Check the error message for more information about the required parameter. |
payment_ | This code can appear in the last_payment_error.code field of a PaymentIntent. Check the error message for a detailed failure reason and suggestion on error handling. |
payment_ | This code can appear in the last_payment_error.code field of a PaymentIntent. Check the error message for a detailed failure reason and suggestion on error handling. This error occurs when you manually trigger a failure when testing your integration. |
payment_ | Provide a return_ when confirming a PaymentIntent. |