Skip to main content

Create the paymentMethod object

The paymentMethod object contains all of the payment method information that the end user provides (see Collect payment method information), and is required for both authorization scenarios. It is your responsibility to validate the data.

note

When you use the payment.js library, you can only store one payment method per user. When you create a new payment method, it overwrites the existing payment method. There is no way to manage multiple payment methods and designate one as the default, which you can do with the Payment Methods API or through the AppMarket user interface.

    const paymentMethod = {
paymentMethodType: "CARD",
currency: "USD",
accountDisplay: "",
properties: {
number: "4111111111111111",
securityCode: "111",
cardHolderName: "John Doe",
expirationMonth: "1",
expirationYear: "2021",
brand: "VISA"
},
billingAddress: {
firstName: "John",
lastName: "Doe",
street1: "123 Main St.",
city: "Springfield",
state: "MA",
country: "US",
zip: "20156"
}
};

Was this page helpful?