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 {
blockedPaymentErrorBodyForBinUnavailable,
blockedPaymentErrorBodyForCardSubtype,
blockedPaymentErrorBodyForDebitCard,
blockedPaymentErrorBodyForIssuingCountry,
cardRequiredField,
customerAcceptance,
} from "./Commons";
const successfulNo3DSCardDetails = {
card_number: "5567630009904309",
card_exp_month: "12",
card_exp_year: "2049",
card_holder_name: "joseph Doe",
card_cvc: "433",
};
const successfulThreeDSTestCardDetails = {
card_number: "4229989999000012",
card_exp_month: "12",
card_exp_year: "2031",
card_holder_name: "joseph Doe",
card_cvc: "871",
};
const failedNo3DSCardDetails = {
card_number: "4000000000000002",
card_exp_month: "01",
card_exp_year: "35",
card_holder_name: "joseph Doe",
card_cvc: "123",
};
const singleUseMandateData = {
customer_acceptance: customerAcceptance,
mandate_type: {
single_use: {
amount: 8000,
currency: "MYR",
},
},
};
const multiUseMandateData = {
customer_acceptance: customerAcceptance,
mandate_type: {
multi_use: {
amount: 8000,
currency: "MYR",
},
},
};
const billingAddress = {
address: {
line1: "1467",
line2: "Harrison Street",
line3: "Harrison Street",
city: "San Fransico",
state: "California",
zip: "94122",
country: "MY",
first_name: "joseph",
last_name: "Doe",
},
email: "[email protected]",
};
const requiredFields = {
payment_methods: [
{
payment_method: "card",
payment_method_types: [
{
payment_method_type: "credit",
card_networks: [
{
eligible_connectors: ["fiuu"],
},
],
required_fields: cardRequiredField,
},
],
},
],
};
const MITErrorResponse = {
status: 200,
body: {
status: "failed",
error_code: "Token not found",
error_message: "Token not found",
},
};
export const connectorDetails = {
real_time_payment_pm: {
DuitNow: {
Configs: {
TRIGGER_SKIP: true, //Since fiuu follows a qr flow we are skipping the qr handling
},
Request: {
payment_method: "real_time_payment",
payment_method_type: "duit_now",
payment_method_data: {
real_time_payment: {
duit_now: {},
},
},
billing: billingAddress,
currency: "MYR",
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
net_amount: 6000,
amount_received: null,
amount: 6000,
},
},
},
},
bank_redirect_pm: {
OnlineBankingFpx: {
Request: {
payment_method: "bank_redirect",
payment_method_type: "online_banking_fpx",
amount: 6000,
currency: "MYR",
payment_method_data: {
bank_redirect: {
online_banking_fpx: {
issuer: "affin_bank",
},
},
},
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
net_amount: 6000,
amount_received: null,
amount: 6000,
},
},
},
},
card_pm: {
PaymentIntent: {
Request: {
currency: "MYR",
customer_acceptance: null,
setup_future_usage: "on_session",
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
"3DSManualCapture": {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "MYR",
customer_acceptance: null,
setup_future_usage: "on_session",
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
"3DSAutoCapture": {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "MYR",
customer_acceptance: null,
setup_future_usage: "on_session",
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
No3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "MYR",
customer_acceptance: null,
setup_future_usage: "on_session",
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
No3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "MYR",
customer_acceptance: null,
setup_future_usage: "on_session",
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
Capture: {
Request: {
amount_to_capture: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
amount: 6000,
amount_capturable: 0,
amount_received: 6000,
},
},
},
PartialCapture: {
Request: {
amount_to_capture: 2000,
},
Response: {
status: 200,
body: {
status: "partially_captured",
amount: 6000,
amount_capturable: 0,
amount_received: 2000,
},
},
},
Void: {
Request: {},
Response: {
status: 200,
body: {
status: "cancelled",
},
},
},
VoidAfterConfirm: {
Request: {},
Response: {
status: 200,
body: {
status: "cancelled",
},
},
},
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",
},
},
},
manualPaymentRefund: {
Request: {
amount: 6000,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
manualPaymentPartialRefund: {
Request: {
amount: 2000,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUse3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "MYR",
mandate_data: singleUseMandateData,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUse3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "MYR",
mandate_data: singleUseMandateData,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
MandateSingleUseNo3DSAutoCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
currency: "MYR",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateSingleUseNo3DSManualCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
currency: "MYR",
mandate_data: singleUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateMultiUseNo3DSAutoCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
currency: "MYR",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
MandateMultiUseNo3DSManualCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
currency: "MYR",
mandate_data: multiUseMandateData,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateMultiUse3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "MYR",
mandate_data: multiUseMandateData,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MandateMultiUse3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "MYR",
mandate_data: multiUseMandateData,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
MITAutoCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
currency: "MYR",
billing: billingAddress,
},
Response: MITErrorResponse,
},
MITAutoCaptureWithCustomerAcceptance: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
currency: "MYR",
billing: billingAddress,
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: "failed",
error_code: "Token not found",
error_message: "Token not found",
},
},
},
MITWithoutBillingAddress: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
billing: null,
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "The currency not allow for the RecordType",
error_message: "The currency not allow for the RecordType",
},
},
},
MITManualCapture: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 6000,
currency: "MYR",
billing: billingAddress,
},
Response: MITErrorResponse,
},
PaymentIntentOffSession: {
Request: {
amount: 6000,
authentication_type: "no_three_ds",
currency: "MYR",
customer_acceptance: null,
setup_future_usage: "off_session",
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
PaymentMethodIdMandateNo3DSAutoCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
currency: "MYR",
mandate_data: null,
customer_acceptance: customerAcceptance,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SaveCardUseNo3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "MYR",
setup_future_usage: "on_session",
customer_acceptance: customerAcceptance,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SaveCardUseNo3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
currency: "MYR",
setup_future_usage: "on_session",
customer_acceptance: customerAcceptance,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardUseNo3DSAutoCaptureOffSession: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
currency: "MYR",
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SaveCardUse3DSAutoCaptureOffSession: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
billing: billingAddress,
},
currency: "MYR",
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
SaveCardUseNo3DSManualCaptureOffSession: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
setup_future_usage: "off_session",
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
SaveCardConfirmAutoCaptureOffSession: {
Request: {
setup_future_usage: "off_session",
billing: billingAddress,
},
Response: MITErrorResponse,
},
SaveCardConfirmManualCaptureOffSession: {
Request: {
setup_future_usage: "off_session",
billing: billingAddress,
},
Response: MITErrorResponse,
},
PaymentMethodIdMandateNo3DSManualCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
billing: billingAddress,
},
currency: "MYR",
mandate_data: null,
customer_acceptance: customerAcceptance,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
},
PaymentMethodIdMandate3DSAutoCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
billing: billingAddress,
},
currency: "MYR",
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
PaymentMethodIdMandate3DSManualCapture: {
Request: {
amount: 6000,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulThreeDSTestCardDetails,
billing: billingAddress,
},
currency: "MYR",
mandate_data: null,
authentication_type: "three_ds",
customer_acceptance: customerAcceptance,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_customer_action",
},
},
},
PaymentConfirmWithShippingCost: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "succeeded",
shipping_cost: 50,
amount_received: 6050,
amount: 6000,
net_amount: 6050,
},
},
},
ZeroAuthMandate: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 0,
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "MYR",
mandate_data: singleUseMandateData,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "processing",
},
},
},
SaveCardConfirmAutoCaptureOffSessionWithoutBilling: {
Request: {
setup_future_usage: "off_session",
billing: null,
},
Response: MITErrorResponse,
},
ZeroAuthPaymentIntent: {
Configs: {
TRIGGER_SKIP: true,
},
Request: {
amount: 0,
setup_future_usage: "off_session",
currency: "MYR",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
setup_future_usage: "off_session",
},
},
},
ZeroAuthConfirmPayment: {
Request: {
amount: 0,
payment_type: "setup_mandate",
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "MYR",
billing: billingAddress,
mandate_data: null,
customer_acceptance: customerAcceptance,
},
Response: {
status: 200,
body: {
status: "processing",
setup_future_usage: "off_session",
},
},
},
PaymentIntentWithShippingCost: {
Request: {
currency: "MYR",
shipping_cost: 50,
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
shipping_cost: 50,
amount: 6000,
},
},
},
CaptureGreaterAmount: {
Request: {
amount_to_capture: 6000000,
},
Response: {
status: 400,
body: {
error: {
type: "invalid_request",
message: "amount_to_capture is greater than amount",
code: "IR_06",
},
},
},
},
No3DSFailPayment: {
Request: {
payment_method: "card",
payment_method_type: "credit",
payment_method_data: {
card: failedNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
billing: billingAddress,
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "CC_82",
error_message: "Invalid CVV/CVC",
unified_code: "UE_9000",
unified_message: "Something went wrong",
},
},
},
PaymentWithoutBilling: {
Request: {
currency: "MYR",
customer_acceptance: null,
setup_future_usage: "on_session",
authentication_type: "no_three_ds",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
PaymentWithBilling: {
Request: {
currency: "MYR",
setup_future_usage: "on_session",
billing: {
address: {
line1: "1467",
line2: "CA",
line3: "Harrison Street",
city: "San Fransico",
state: "CA",
zip: "94122",
country: "MY",
first_name: "joseph",
last_name: "Doe",
},
phone: {
number: "9111222333",
country_code: "+91",
},
},
email: "[email protected]",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
PaymentWithFullName: {
Request: {
currency: "MYR",
setup_future_usage: "on_session",
billing: {
address: {
first_name: "joseph",
last_name: "Doe",
},
phone: {
number: "9111222333",
country_code: "+91",
},
},
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
PaymentWithBillingEmail: {
Request: {
currency: "MYR",
setup_future_usage: "on_session",
email: "[email protected]",
billing: {
address: {
first_name: "joseph",
last_name: "Doe",
},
phone: {
number: "9111222333",
country_code: "+91",
},
email: "[email protected]",
},
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
},
ManualRetryPaymentDisabled: {
Request: {
payment_method: "card",
payment_method_type: "credit",
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_type: "credit",
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_type: "credit",
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",
},
},
},
},
pm_list: {
PmListResponse: {
PmListNull: {
payment_methods: [],
},
pmListDynamicFieldWithoutBilling: requiredFields,
pmListDynamicFieldWithBilling: requiredFields,
pmListDynamicFieldWithNames: requiredFields,
pmListDynamicFieldWithEmail: requiredFields,
},
},
webhook: {
TransactionIdConfig: {
// Defines how to locate and parse the payment reference ID from connector-specific webhook payloads
path: "orderid",
// Type of payment reference ID
type: "string",
// Fiuu webhook handler uses PaymentAttemptId for lookup, not ConnectorTransactionId
source: "paymentAttemptID",
},
RefundIdConfig: {
// Fiuu refund webhooks carry the connector refund ID in the RefundID field
path: "RefundID",
type: "string",
},
},
payment_method_blocking_pm: {
BlockIssuingCountry: {
Request: {
payment_method: "card",
payment_method_data: {
card: {
card_number: "4000000000000002",
card_exp_month: "03",
card_exp_year: "30",
card_holder_name: "joseph Doeeee",
card_cvc: "737",
card_network: "Visa",
},
},
billing: billingAddress,
currency: "MYR",
},
Response: blockedPaymentErrorBodyForIssuingCountry,
},
BlockCardType: {
Request: {
payment_method: "card",
payment_method_data: {
card: {
card_number: "4111111111111111",
card_exp_month: "03",
card_exp_year: "30",
card_holder_name: "joseph Doeeee",
card_cvc: "737",
card_network: "Visa",
},
},
billing: billingAddress,
currency: "MYR",
},
Response: blockedPaymentErrorBodyForDebitCard,
},
BlockCardSubtype: {
Request: {
payment_method: "card",
payment_method_data: {
card: {
card_number: "378282246310005",
card_exp_month: "03",
card_exp_year: "30",
card_holder_name: "joseph Doeeee",
card_cvc: "737",
card_network: "Visa",
},
},
currency: "MYR",
billing: billingAddress,
},
Response: blockedPaymentErrorBodyForCardSubtype,
},
BlockIfBinInfoUnavailable: {
Request: {
payment_method: "card",
payment_method_data: {
card: {
card_number: "6304000000000000",
card_exp_month: "03",
card_exp_year: "30",
card_holder_name: "joseph Doeeee",
card_cvc: "737",
card_network: "Visa",
},
},
billing: billingAddress,
currency: "MYR",
},
Response: blockedPaymentErrorBodyForBinUnavailable,
},
},
};