Skip to main content

Sandbox: In-person card payments

When testing your integration, use the Partner Testing API to simulate in-person card payment events.

Prerequisites​

  • Merchant profile status: Enabled.
  • In-person card payment method status: Enabled.
  • Simulate updating the statuses for your merchant profile and payment method if needed.

Simulate enabling the payment method​

Use the existing simulateMerchantPaymentMethodRequestOutcome mutation to enable your in-person card payment method.

mutation EnableInPersonCardMethod {
simulateMerchantPaymentMethodRequestOutcome(
input: {
merchantPaymentMethodId: "$YOUR_PAYMENT_METHOD_ID"
merchantPaymentMethodStatus: Enabled
}
) {
__typename
... on Rejection {
message
}
}
}

Simulate a payment authorization​

To simulate a card payment, first create a payment intent using the main API, then call simulateIncomingInPersonCardAuthorization in the Testing API with the secret from the payment intent.

During the simulation, Swan creates the merchant payment and underlying transactions as if a real card was tapped.

Simulate a successful payment​

mutation SimulateInPersonAuthorization {
simulateIncomingInPersonCardAuthorization(
input: {
paymentIntentSecret: "$YOUR_PAYMENT_INTENT_SECRET"
authorization: {
status: authorized
}
cardDetails: {
InPersonCardDetailsScheme: visa
}
}
) {
... on SimulateIncomingInPersonCardAuthorizationSuccessPayload {
paymentIntentId
}
}
}

Simulate a rejected payment​

mutation SimulateInPersonRejection {
simulateIncomingInPersonCardAuthorization(
input: {
paymentIntentSecret: "$YOUR_PAYMENT_INTENT_SECRET"
authorization: {
status: rejected
rejectionReason: SoftDeclineInsufficientFunds
}
cardDetails: {
InPersonCardDetailsScheme: visa
}
}
) {
... on SimulateIncomingInPersonCardAuthorizationSuccessPayload {
paymentIntentId
}
}
}

Available test scenarios​

Card schemeAuthorizedRejected
visa✓✓
mastercard✓✗
cartesBancaires✓✗
americanExpress✓✗
discover✓✗

Available rejection reasons (Visa only): RejectedByCardIssuer SoftDeclineRejectedByCardIssuer SoftDeclineInsufficientFunds.

Finding the merchant payment

The simulation returns a paymentIntentId, not a merchant payment ID. To find the associated merchant payment, use the externalReference or reference you set when creating the payment intent.

Simulate settlement​

After simulating a successful authorization, transactions are created as Upcoming. Use simulateIncomingInPersonCardSettlement to simulate the settlement process.

The simulation creates a Booked credit transfer for the total amount and moves all included transactions to Settled. Each settled transaction is linked to the credit transfer through the settlementTransactionId field.

mutation SimulateInPersonSettlement {
simulateIncomingInPersonCardSettlement(
input: {
merchantPaymentIds: [
"$YOUR_MERCHANT_PAYMENT_ID_1"
"$YOUR_MERCHANT_PAYMENT_ID_2"
]
}
) {
... on SimulateIncomingInPersonCardSettlementSuccessPayload {
merchantPayments {
id
statusInfo {
status
}
}
}
}
}

Coming soon​

Simulations for the following scenarios are in development and will be included in a future release.

  • Chargebacks and disputes
  • Refunds

Test cards​

In-person card payments use Stripe's test card numbers for Sandbox testing. Refer to Stripe's testing documentation for the full list of available test cards.