Accept a payment with Alma
Learn how to setup your integration with Alma.
Use Payment Elements to embed a custom Stripe payment form in your website or application. Payment Elements allows you to support Alma and other payment methods automatically. 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:
Create a PaymentIntentServer-side
Stripe uses a PaymentIntent object to represent your intent to collect payment from a customer, tracking charge attempts, and payment state changes throughout the process.
Retrieve the client secret
The PaymentIntent includes a client secret that the client side uses to securely complete the payment process. You can use different approaches to pass the client secret to the client side.
Collect payment detailsClient-side
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.
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 should redirect the user after they complete the payment. Your user may be first redirected to an intermediate site, like a bank authorization page, before being redirected to the return_
. Card payments immediately redirect to the return_
when a payment is successful.
Make sure the return_
corresponds to a page on your website that provides the status of the payment. When Stripe redirects the customer to the return_
, we provide the following URL query parameters:
Parameter | Description |
---|---|
payment_ | The unique identifier for the PaymentIntent . |
payment_ | The client secret of the PaymentIntent object. |
Caution
If you have tooling that tracks the customer’s browser session, you might need to add the stripe.
domain to the referrer exclude list. Redirects cause some tools to create new sessions, which prevents you from tracking the complete session.
Use one of the query parameters to retrieve the PaymentIntent. Inspect the status of the PaymentIntent to decide what to show your customers. You can also append your own query parameters when providing the return_
, which persist through the redirect process.
Redirect and authenticate transactions
Customers can authenticate Alma transactions with mobile or desktop apps. The client that customer uses determines the authentication method after calling confirmPayment
.
Test your integration
To test your integration, choose Alma as 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 Alma website—you don’t have the option to approve or decline the payment with Alma.
Failed payments 
Alma uses multiple data points to decide when to decline a transaction (for example, their AI model detected high consumer fraud risk for the transaction, or the consumer has revoked your permission to charge them in Alma).
In these cases, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_
.
Other than a payment being declined, for an Alma PaymentIntent with a status of requires_
, customers must complete the payment within 1 hour after they’re redirected to Alma. If no action is taken after 1 hour, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_
.
When this happens, the Payment Element renders error messages and instructs your customer to retry using a different payment method.
Error codes 
The following table details common error codes and recommended actions:
Error code | Recommended action |
---|---|
payment_ | Enter the appropriate currency. Alma only supports eur . |
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_ | Provide a return_ when confirming a PaymentIntent with Alma. |