@flyeralarmdigital/fadc-payments v1.0.1
FlyerAlarm @Digital
Npm Payment Package
Features
- get payment methods supported by Adyen for your country
- payment-components for 3D Secure Credit-Cards (including 3D Secure authentication flow), Paypal, Instant-Bank-Transfer (Klarna) and Invoice (Klarna)
Methods
getPaymentMethods
Method:
getPaymentMethods: (shopper_locale, country_code, value, API)
You have to provide a shopper_locale (e.g. de-DE), country_code (ISO 3166-1 alpha-2) and the total value of the order. You can also provide an optional API-URL.
mountCheckout
Method:
mountCheckout: (method, adyenConfig, checkoutConfig, order, paymentMethods, redirectUrl, clientIp, callbacks)
method (String): The desired payment-method. Availlable options are "threedsecure" (for 3D Secure Credit-Cards), "paypal", "sofort" and "invoice" adyenConfig (Object): Key "MERCHANT_ACCOUNT" is required. For Paypal "PAYPAL_MERCHANT_ID" is also required checkoutConfig (Object): Configuration for the checkout (depends on the payment_method) order (Object): A order-object paymentMethods (object): redirectUrl (String): URL where the user should redirected after a successful payment clientIp (String): IP-Address of the user callbacks (Object): you can provide a function for the key "error" in case of a unsuccessful payment. You have to provide a function for the key "success" for Paypal payments.
This method will mount the Adyen-Component on the page, create an order with the fad-order-package and handle redirects.
Example-Configuration for each payment_method:
const threeDSecureConfig = {
amount: { currency: "EUR", value: 29988},
billingAddressRequired: false,
brands: ["mc", "visa"],
clientKey: "insert client key here",
environment: "LIVE",
hasHolderName: true,
holderNameRequired: true,
merchantAccount: "insert merchant-account here",
paymentMethodsConfiguration: {
card: {
hasHolderName: true,
holderNameRequired: true,
enableStoreDetails: true,
hideCVC: false,
name: "Credit or debit card"
}
},
paymentMethodsResponse: {}, // this is the response of getPaymentMethods
showBrandIcon: true,
showPayButton: true
}
const invoiceConfig = {
amount: { currency: "EUR", value: 29988},
environment: "LIVE",
merchantAccount: "insert merchant-account here",
paymentMethodsResponse: {}, // this is the response of getPaymentMethods
showBrandIcon: true,
showPayButton: true
}
const sofortConfig = {
amount: { currency: "EUR", value: 29988},
countryCode: "DE"
environment: "LIVE",
intent: "capture",
paymentMethodsResponse: {}, // this is the response of getPaymentMethods
showBrandIcon: true,
showPayButton: true
}
const paypalConfig = {
amount: { currency: "EUR", value: 29988},
countryCode: "DE"
environment: "LIVE",
intent: "capture",
merchantId: "your paypal-merchant-ID",
paymentMethodsResponse: {}, // this is the response of getPaymentMethods
showBrandIcon: true,
showPayButton: true
}
authorize3d
Method:
authorize3d: (search)
search (String): The GET-Parameters of the URL
Use this method for the 3D-redirect-Workflow. It must be called on the page provided as callback-URL at mountCheckout() It returns true if successful or throws an Error if unsuccessful