Accept a payment with Alma
Learn how to set up your integration with Alma.
Use the Mobile Payment Element, an embeddable payment form, to add Alma and other payment methods to your integration with the least amount of effort.
Alma is a single-use payment method where customers choose to pay between 2, 3, or 4 instalments. Customers are redirected from your website or app, authorise the payment with Alma, then return to your website or app. You get immediate notification of whether the payment succeeded or failed.
Set up StripeServer-sideClient-side
First, you need a Stripe account. Register now.
Server-side
This integration requires endpoints on your server that talk to the Stripe API. Use the official libraries for access to the Stripe API from your server:
Client-side
The Stripe iOS SDK is open source, fully documented, and compatible with apps supporting iOS 13 or above.
Note
For details on the latest SDK release and past versions, see the Releases page on GitHub. To receive notifications when a new release is published, watch releases for the repository.
Configure the SDK with your Stripe publishable key on app start. This enables your app to make requests to the Stripe API.
Create a PaymentIntentServer-sideClient-side
Server-side
A PaymentIntent is an object that represents your intent to collect payment from a customer and tracks the lifecycle of the payment process through each stage.
Caution
Always decide how much to charge on the server-side, a trusted environment, as opposed to the client. This prevents customers from being able to choose their own prices.
Client-side
On the client, request a PaymentIntent from your server and store its client secret.
Submit the payment to StripeClient-side
When a customer taps to pay with Alma, confirm the PaymentIntent
to complete the payment. Configure an STPPaymentIntentParams
object with the PaymentIntent
client secret.
The client secret is different from your API keys that authenticate Stripe API requests. Handle it carefully because it can complete the charge. Don’t log it, embed it in URLs, or expose it to anyone but the customer.
Set up a return URL
The iOS SDK presents a webview in your app to complete the Alma payment. When authentication is finished, the webview can automatically dismiss itself instead of your customer closing it. To enable this behaviour, configure a custom URL scheme or universal link and set up your app delegate to forward the URL to the SDK.
Pass the URL as the return_
when you confirm the PaymentIntent. After webview-based authentication finishes, Stripe redirects the user to the return_
.
Confirm the Alma payment
Complete the payment by calling STPPaymentHandler.
. This presents a webview where the customer can complete the payment with Alma. After completion, Stripe calls the completion block with the result of the payment.
Supported currencies
You can create Alma payments in the currencies that map to your country. The default local currency for Alma is eur
and customers also see their purchase amount in eur
.
Currency | Country |
---|---|
eur | France, Italy, Spain, Netherlands, Belgium, Luxembourg |
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.