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";
const successfulNo3DSCardDetails = {
card_number: "4111111111111111",
card_exp_month: "12",
card_exp_year: "2030",
card_holder_name: "Test User",
card_cvc: "123",
};
const successfulThreeDSTestCardDetails = {
card_number: "4000002500003155",
card_exp_month: "12",
card_exp_year: "2030",
card_holder_name: "Test User",
card_cvc: "123",
};
const singleUseMandateData = {
customer_acceptance: customerAcceptance,
mandate_type: {
single_use: {
amount: 6540,
currency: "USD",
},
},
};
const multiUseMandateData = {
customer_acceptance: customerAcceptance,
mandate_type: {
multi_use: {
amount: 6540,
currency: "USD",
},
},
};
const returnUrl = "https://example.com/return";
export const connectorDetails = {
card_pm: {
PaymentIntent: {
Request: {
amount: 6540,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
setup_future_usage: "on_session",
},
},
},
PaymentIntentOffSession: {
Request: {
amount: 6540,
authentication_type: "no_three_ds",
currency: "USD",
customer_acceptance: null,
setup_future_usage: "off_session",
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
No3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "succeeded",
payment_method: "card",
attempt_count: 1,
},
},
},
No3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "requires_capture",
payment_method: "card",
attempt_count: 1,
},
},
},
"3DSAutoCapture": {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
amount: 6540,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
"3DSManualCapture": {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
amount: 6540,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "USD",
shipping_cost: 50,
amount: 6540,
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "succeeded",
shipping_cost: 50,
amount_received: 6590,
amount: 6540,
},
},
},
Void: {
Request: {},
Response: {
status: 200,
body: {
status: "cancelled",
},
},
},
No3DSFailPayment: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
return_url: returnUrl,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
No3DSAutoCaptureDebit: {
Request: {
payment_method: "card",
payment_method_type: "debit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
payment_method: "card",
attempt_count: 1,
},
},
},
No3DSManualCaptureDebit: {
Request: {
payment_method: "card",
payment_method_type: "debit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_capture",
payment_method: "card",
attempt_count: 1,
},
},
},
Refund: {
Request: {
amount: 6540,
},
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: 6540,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
PartialCapture: {
Request: {
amount_to_capture: 2000,
},
Response: {
status: 200,
body: {
status: "partially_captured",
},
},
},
manualPaymentRefund: {
Request: {
amount: 6540,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
manualPaymentPartialRefund: {
Request: {
amount: 2000,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUse3DSAutoCapture: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
amount: 6540,
currency: "USD",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUse3DSManualCapture: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
amount: 6540,
currency: "USD",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateMultiUse3DSAutoCapture: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
amount: 6540,
currency: "USD",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateMultiUse3DSManualCapture: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
amount: 6540,
currency: "USD",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateSingleUseNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUseNo3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateMultiUseNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateMultiUseNo3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
ZeroAuthMandate: {
Request: {
amount: 0,
},
Response: {
status: 501,
body: {
error: {
type: "invalid_request",
message: "Setup Mandate flow for Rapyd is not implemented",
code: "IR_00",
},
},
},
},
ZeroAuthPaymentIntent: {
Request: {
amount: 0,
currency: "USD",
setup_future_usage: "off_session",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
ZeroAuthConfirmPayment: {
Request: {
amount: 0,
payment_type: "setup_mandate",
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 400,
body: {
error: {
type: "invalid_request",
message: "Setup Mandate flow for Rapyd is not implemented",
code: "IR_00",
},
},
},
},
PaymentMethodIdMandateNo3DSAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
PaymentMethodIdMandateNo3DSManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
PaymentMethodIdMandate3DSAutoCapture: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
PaymentMethodIdMandate3DSManualCapture: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
SaveCardUseNo3DSAutoCapture: {
Configs: {
DELAY: {
STATUS: true,
TIMEOUT: 2000,
},
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SaveCardUseNo3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
amount: 6540,
currency: "USD",
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardUse3DSAutoCapture: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
amount: 6540,
currency: "USD",
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
SaveCardUse3DSManualCapture: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
amount: 6540,
currency: "USD",
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
SaveCardUse3DSAutoCaptureOffSession: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
SaveCardUse3DSManualCaptureOffSession: {
// Skipping 3DS testing due to limitations of the Cypress browser environment.
// The 'Continue' action works intermittently in the Cypress browser, succeeding at times and failing at others.
// This is not an issue with Hyperswitch or the Rapyd connector.
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
SaveCardUseNo3DSAutoCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
payment_method: "card",
payment_method_type: "credit",
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_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardConfirmAutoCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
setup_future_usage: "off_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SaveCardConfirmManualCaptureOffSession: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
setup_future_usage: "off_session",
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardConfirmAutoCaptureOffSessionWithoutBilling: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
setup_future_usage: "off_session",
billing: null,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
ManualRetryPaymentDisabled: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 400,
body: {
type: "invalid_request",
message:
"You cannot confirm this payment because it has status failed, you can enable `manual_retry` in profile to try this payment again",
code: "IR_16",
},
},
},
ManualRetryPaymentEnabled: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
payment_method: "card",
attempt_count: 2,
},
},
},
ManualRetryPaymentCutoffExpired: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 400,
body: {
type: "invalid_request",
message:
"You cannot confirm this payment using `manual_retry` because the allowed duration has expired",
code: "IR_16",
},
},
},
},
bank_transfer_pm: {},
wallet_pm: {},
};