Skip to content

Instantly share code, notes, and snippets.

@nicoespeon
Created August 12, 2020 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicoespeon/edd4099a42f0c17097947b362d5fdb3f to your computer and use it in GitHub Desktop.
Save nicoespeon/edd4099a42f0c17097947b362d5fdb3f to your computer and use it in GitHub Desktop.
Params we use to instantiate the DropIn
const checkout = new AdyenCheckout({
"locale": "en",
"originKey": "...",
"environment": "test",
"translations": {
"en": {
"creditCard.holderName.invalid": "Oops! Something Went Wrong",
"creditCard.numberField.title": "Card Number",
"creditCard.numberField.placeholder": "•••• •••• •••• ••••",
"creditCard.numberField.invalid": "Oops! Something Went Wrong",
"creditCard.expiryDateField.title": "Expiry Date",
"creditCard.expiryDateField.placeholder": "MM / YY",
"creditCard.expiryDateField.invalid": "Oops! Something Went Wrong",
"creditCard.expiryDateField.month": "Month",
"creditCard.expiryDateField.month.placeholder": "MM",
"creditCard.expiryDateField.year.placeholder": "Year",
"creditCard.expiryDateField.year": "YY",
"creditCard.cvcField.title": "Security code",
"creditCard.cvcField.placeholder": "123",
"payButton": "Pay",
"installments": "Number of installments",
"creditCard.holderName": "Name on Card",
"creditCard.holderName.placeholder": "J. Smith",
"storeDetails": "Save for my next payment"
}
},
"paymentMethodsResponse": {
"groups": [
{
"name": "Credit Card",
"types": ["visa", "mc", "amex", "discover", "maestro", "diners"]
}
],
"paymentMethods": [
{
"brands": ["visa", "mc", "amex", "discover", "maestro", "diners"],
"details": [
{ "key": "number", "type": "text" },
{ "key": "expiryMonth", "type": "text" },
{ "key": "expiryYear", "type": "text" },
{ "key": "cvc", "type": "text" },
{ "key": "holderName", "optional": true, "type": "text" }
],
"name": "Credit Card",
"type": "scheme"
},
{
"details": [{ "key": "applepay.token", "type": "applePayToken" }],
"name": "Apple Pay",
"supportsRecurring": true,
"type": "applepay"
},
{
"configuration": { "merchantId": "1000" },
"details": [
{ "key": "paywithgoogle.token", "type": "payWithGoogleToken" }
],
"name": "Google Pay",
"supportsRecurring": true,
"type": "paywithgoogle"
}
]
}
});
const dropin = checkout.create('dropin', {
"paymentMethodsConfiguration": {
"card": {
"enableStoreDetails": true,
"hasHolderName": true,
"hideCVC": false,
"holderNameRequired": true
},
"applepay": {
"amount": 5160,
"totalPriceLabel": "Total",
"currencyCode": "USD",
"countryCode": "US",
"merchantCapabilities": ["supports3DS"],
"requiredBillingContactFields": ["name"],
"requiredShippingContactFields": [],
"lineItems": [
{ "label": "Subtotal", "amount": 44.05 },
{ "label": "Fees", "amount": 0.94 },
{ "label": "Taxes", "amount": 6.61 }
],
"configuration": {
"merchantName": "Busbud",
"merchantIdentifier": "merchant.com.adyen.Busbud.test"
}
},
"paywithgoogle": {
"environment": "TEST",
"amount": { "currency": "USD", "value": 5160 },
"configuration": {
"gatewayMerchantId": "BusbudUSA",
"merchantName": "Busbud"
},
"emailRequired": true
}
},
"showStoredPaymentMethods": true
}).mount('#dropin-container');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment