Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
import { customerAcceptance } from "./Commons";
import { getCustomExchange } from "./Modifiers";
const successfulNo3DSCardDetails = {
card_number: "4242424242424242",
card_exp_month: "01",
card_exp_year: "2045",
card_holder_name: "morino",
card_cvc: "737",
};
const successfulThreeDSTestCardDetails = {
card_number: "5386024192625914",
card_exp_month: "01",
card_exp_year: "2045",
card_holder_name: "morino",
card_cvc: "737",
};
// This card details will fail because of card expiryYear
const failedNo3DSCardDetails = {
card_number: "4012001037461114",
card_exp_month: "01",
card_exp_year: "35",
card_holder_name: "joseph Doe",
card_cvc: "737",
};
const singleUseMandateData = {
customer_acceptance: customerAcceptance,
mandate_type: {
single_use: {
amount: 8000,
currency: "EUR",
},
},
};
const multiUseMandateData = {
customer_acceptance: customerAcceptance,
mandate_type: {
multi_use: {
amount: 8000,
currency: "EUR",
},
},
};
const billingAddress = {
address: {
line1: "1467",
line2: "Harrison Street",
line3: "Harrison Street",
city: "San Fransico",
state: "California",
zip: "94122",
country: "NL",
first_name: "joseph",
last_name: "Doe",
},
phone: {
number: "9123456789",
country_code: "+91",
},
};
const billingAddressAT = {
...billingAddress,
address: {
...billingAddress.address,
country: "AT",
},
};
export const connectorDetails = {
card_pm: {
PaymentIntent: {
Request: {
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
setup_future_usage: "on_session",
},
},
},
PaymentIntentOffSession: {
Request: {
amount: 6000,
authentication_type: "no_three_ds",
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "off_session",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
No3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
payment_method: "card",
attempt_count: 1,
},
},
},
No3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_capture",
payment_method: "card",
attempt_count: 1,
},
},
},
"3DSAutoCapture": {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
"3DSManualCapture": {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "EUR",
shipping_cost: 50,
amount: 6000,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
shipping_cost: 50,
amount_received: 6050,
amount: 6000,
},
},
},
Refund: {
Request: {
amount: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
PartialRefund: {
Request: {
amount: 2000,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SyncRefund: {
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
Capture: {
Request: {
amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
PartialCapture: {
Request: {
amount_to_capture: 2000,
},
Response: {
status: 200,
body: {
status: "partially_captured",
},
},
},
manualPaymentRefund: {
Request: {
amount: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
manualPaymentPartialRefund: {
Request: {
amount: 2000,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUse3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUse3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateSingleUseNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUseNo3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateMultiUseNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateMultiUseNo3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateMultiUse3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateMultiUse3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
ZeroAuthMandate: {
Request: {
amount: 0,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
ZeroAuthPaymentIntent: {
Request: {
amount: 0,
setup_future_usage: "off_session",
currency: "EUR",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
setup_future_usage: "off_session",
},
},
},
ZeroAuthConfirmPayment: {
Request: {
amount: 0,
currency: "EUR",
payment_type: "setup_mandate",
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SaveCardUseNo3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
setup_future_usage: "on_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SaveCardUseNo3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
setup_future_usage: "on_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardUseNo3DSAutoCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "debit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SaveCardUseNo3DSManualCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardUse3DSAutoCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "debit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
SaveCardConfirmAutoCaptureOffSession: {
Request: {
setup_future_usage: "off_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
PaymentMethodIdMandateNo3DSAutoCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
PaymentMethodIdMandateNo3DSManualCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
PaymentMethodIdMandate3DSAutoCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
PaymentMethodIdMandate3DSManualCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "EUR",
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
MITManualCapture: {
Request: {
amount: 6000,
currency: "EUR",
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MITAutoCapture: {
Request: {
amount: 6000,
currency: "EUR",
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MITAutoCaptureWithCustomerAcceptance: {
Request: {
amount: 6000,
currency: "EUR",
customer_acceptance: {
acceptance_type: "offline",
accepted_at: "1963-05-03T04:07:52.723Z",
online: {
ip_address: "127.0.0.1",
user_agent: "amet irure esse",
},
},
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
No3DSFailPayment: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_data: {
card: failedNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "100.390.112",
error_message: "Technical Error in 3D system",
unified_code: "UE_9000",
unified_message: "Something went wrong",
},
},
},
},
bank_redirect_pm: {
Ideal: {
Request: {
payment_method: "bank_redirect",
payment_method_type: "ideal",
payment_method_data: {
bank_redirect: {
ideal: {
bank_name: "ing",
},
},
},
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
Giropay: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "bank_redirect",
payment_method_type: "giropay",
payment_method_data: {
bank_redirect: {
giropay: {
bank_name: "",
bank_account_bic: "",
bank_account_iban: "",
preferred_language: "en",
country: "DE",
},
},
},
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "800.900.300",
error_message: "invalid authentication information",
},
},
},
Eps: {
Request: {
payment_method: "bank_redirect",
payment_method_type: "eps",
payment_method_data: {
bank_redirect: {
eps: {
bank_name: "ing",
},
},
},
billing: billingAddressAT,
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "800.900.300",
error_message: "invalid authentication information",
},
},
},
Sofort: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "bank_redirect",
payment_method_type: "sofort",
payment_method_data: {
bank_redirect: {
sofort: {
country: "DE",
preferred_language: "en",
},
},
},
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "failed",
error_message: "invalid authentication information",
},
},
},
Przelewy24: {
Request: {
payment_method: "bank_redirect",
payment_method_type: "przelewy24",
payment_method_data: {
bank_redirect: {
przelewy24: {
bank_name: "citi",
billing_details: {
email: "[email protected]",
},
},
},
},
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "200.100.103",
error_message:
"invalid Request Message. The request contains structural errors",
},
},
},
Interac: {
Request: {
payment_method: "bank_redirect",
payment_method_type: "interac",
payment_method_data: {
bank_redirect: {
interac: {
bank_name: "ing",
},
},
},
billing: {
...billingAddress,
email: "[email protected]",
},
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "600.200.500",
error_message: "invalid authentication information",
},
},
},
Eft: {
Request: {
payment_method: "bank_redirect",
payment_method_type: "eft",
payment_method_data: {
bank_redirect: {
eft: {
provider: "ozow",
},
},
},
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "200.300.404",
error_message: "invalid or missing parameter",
},
},
},
},
pay_later_pm: {
PaymentIntent: getCustomExchange({
Request: {
currency: "EUR",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
}),
AutoCapture: getCustomExchange({
Request: {
currency: "EUR",
capture_method: "automatic",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
}),
ManualCapture: getCustomExchange({
Request: {
currency: "EUR",
capture_method: "manual",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
}),
Klarna: getCustomExchange({
Request: {
payment_method: "pay_later",
payment_method_type: "klarna",
payment_experience: "redirect_to_url",
payment_method_data: {
pay_later: {
klarna_redirect: {
billing_email: "[email protected]",
billing_country: "DE",
},
},
},
billing: billingAddress,
order_details: [
{
product_name: "Test Product",
quantity: 1,
amount: 6000,
},
],
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
}),
Capture: getCustomExchange({
Request: {
amount_to_capture: 6000,
},
}),
},
};