@mangopay/vault-sdk v1.1.5
Vault SDK - User integration guide
Installation
The MangoPay Vault SDK is available on npm. See @mangopay/vault-sdk for an API reference.
npm install --save @mangopay/vault-sdk
# or
yarn add @mangopay/vault-sdk
Create a Card Registration
Send the request to https://api.mangopay.com/v2.01/clientId/cardregistrations with the input JSON data, where clientId is the ID of your MangoPay client account.
CreateCardRegistrationResult
Promise<CreateCardRegistrationResult>;
Prop | Type |
---|---|
Id | String |
CardRegistrationURL The URL to submit the card details form to | String |
AccessKey A special key to use when registering a card | String |
PreregistrationData A specific value to pass to the CardRegistrationURL | String |
errors | MgpTypedError |
MgpTypedError
type MgpTypedError<T> = {
[Property in keyof T]: string;
};
Initialisation
import { MangopayVault } from '@mangopay/vault-sdk';
const options = {
clientId: 'MANGOPAY_CLIENT_ACCOUNT_ID',
environment: 'SANDBOX | PRODUCTION',
};
const vault = MangopayVault.initialize(options);
How it works
The Vault API provides you with tokenizePaymentMethod( );
Tokenize Payment Method
CardInfoObject
Prop | Type |
---|---|
cardNumber The card number, as a string without any separators | String |
cardExpirationDate Card expiration date - should be in format MMYY | String |
cardCvx Card security code | String |
const cardInfoObject = {
cardNumber: '4970107111111119',
cardExpirationDate: '1127',
cardCvx: '123',
};
const preregistrationData = {
id: createCardRegistrationResult.Id,
cardRegistrationURL: createCardRegistrationResult.CardRegistrationURL,
accessKeyRef: createCardRegistrationResult.AccessKey,
data: createCardRegistrationResult.PreregistrationData,
};
const tokenizePaymentMethodResult = await vault.tokenizePaymentMethod(cardInfoObject, preregistrationData);
TokenizePaymentMethodResult
Promise<UpdateCardRegistrationOutput>;
UpdateCardRegistrationOutput
Prop | Type |
---|---|
Id | String |
CardRegistrationURL The URL to submit the card details form to | String |
AccessKey A special key to use when registering a card | String |
PreregistrationData A specific value to pass to the CardRegistrationURL | String |
CardId The ID of a card | String |
errors | MgpTypedError |
9 days ago
9 days ago
10 days ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
5 months ago
8 months ago
9 months ago
10 months ago
10 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
10 months ago
10 months ago
10 months ago
7 months ago
6 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago