This section guides you through the Pesaswap Payment Methods Management, and how to integrate it.
Key Features of Payment Method Management in Pesaswap
Pesaswap simplifies the complexities of payment method management, so you can offer a seamless, secure experience to your customers with minimal effort.- Payment Method Creation: Easily allow your customers to save new payment methods during checkout, providing a convenient option for future transactions.
- Storing Payment Methods: Pesaswap securely stores customer payment details, enabling repeat purchases without requiring them to re-enter their information each time.
- Retrieving Payment Methods: Customers can quickly access their saved payment methods, streamlining their checkout process and enhancing their overall experience.
- Deleting/Deactivating Payment Methods: Keep payment options up to date by allowing customers to manage outdated or inactive methods, ensuring a clean and efficient payment experience.
As of now, Pesaswap only supports management of the payment methods saved during checkout. We will soon roll out the feature enabling you to add a payment method for a non-purchase journey.
1. Setup the Server
1.1 Create an Ephemeral Key
Get your API key from Pesaswap dashboard. Add an endpoint on your server that creates an Ephemeral Key. An ephemeral key is a temporary, short-lived key used to securely manage sensitive operations, such as updating or deleting payment methods, without exposing full access credentials. It has a limited validity period and restricted capabilities, ensuring that it can only be used for specific tasks and not for initiating payments. This enhances security by minimizing the risk of unauthorized access and reducing the exposure of sensitive data. Return the secret obtained in the response to setup Payment Methods Management on client.2. Build Payment Management Page on the client
2.1 Install the required libraries
For React:2.2 Import and initialize
Import the necessary components and initializehyper-js with your publishable API key.
2.3 Load hyper-js
CallloadHyper with your publishable API keys to configure the library. To get a publishable Key please find it here.
2.4 Fetch the Payment
Make a request to the endpoint on your server to create a new Ephemeral Key. TheephemeralKey returned by your endpoint is used to fetch all the customer saved payment methods.
2.5 Initialise HyperManagementElements
Pass the promise fromloadHyper to the HyperManagementElements component. This allows the child components to access the Hyper service via the HyperManagementElements parent component. Additionally, pass the ephemeralKey in options to the HyperManagementElements component.
2.6 Add the Payment Methods Management Element
Add thePaymentMethodsManagementElement to your Payment Management Form. This embeds an iframe with a dynamic form that displays saved payment methods, allowing your customer to see all their saved payment methods and delete them.