Skip to content

SDK Card Payment - Non Direct Payment

Endpoint Information

PropertyValue
Method + URLPOST /card-v2/v1/charge
Content-Typeapplication/json
AuthorizationBasic <Base64Token>

Headers

HeaderRequiredDescription
Authorization✅ RequiredBasic {Base64 of merchantId:secretUnbound:hashKey}
Content-Type✅ Requiredapplication/json
X-Idempotency-KeyRecommendedUnique key per request to make retries safe

Request Body

This is the exact request payload generated by PaymentGateway after PaymentViewModel builds and serializes a PaymentRequest.

Field names follow the Kotlin data classes, while the JSON wire format uses snake_case where annotated with @SerialName.

Full Request Body Example

json
{
  "externalId": "1Ktru19Cp7",
  "orderId": "ONxeTcEBE6",
  "currency": "IDR",
  "source": "payment_page",
  "paymentMethod": "card",
  "paymentChannel": "BRICC",
  "paymentMode": "CLOSE",
  "paymentDetails": {
    "amount": 10000,
    "isCustomerPayingFee": false,
    "transactionDescription": "Clothes",
    "expiredTime": ""
  },
  "itemDetails": [
    {
      "itemId": "Artikel 1",
      "name": "shirt",
      "amount": 10000,
      "qty": 1
    }
  ],
  "customerDetails": {
    "email": "[email protected]",
    "fullName": "Testing",
    "phone": "0897xxxxxxx",
    "ipAddress": "182.30.91.67"
  },
  "billingAddress": {
    "fullName": "CC Test",
    "address": "...",
    "city": "Tangerang",
    "postalCode": "19127",
    "country": "ID"
  },
  "shippingAddress": {
    "fullName": "MCP",
    "address": "...",
    "city": "Malang",
    "postalCode": "10210",
    "country": "ID"
  },
  "cardDetails": {
    "cardNumber": "",
    "cardExpiredMonth": "",
    "cardExpiredYear": "",
    "cardCvn": "",
    "cardHolderName": ""
  },
  "returnUrl": "https://superapp-stg.ifortepay.id/",
  "callbackUrl": "https://mcpid.free.beeceptor.com",
  "paymentOptions": {
    "useRewards": true,
    "campaign_code": "002",
    "tenor": "0"
  },
  "additionalData": ""
}

PaymentRequest Fields

FieldTypeRequiredDescription
externalIdString✅ RequiredUnique merchant-side ID (max 64 chars)
orderIdString✅ RequiredOrder ID (max 64 chars)
currencyString✅ Required"IDR"
paymentMethodString✅ Required"card" or "ewallet" depending on flow
paymentChannelString✅ Required"BRICC"
paymentModeString✅ Required"CLOSE" or "OPEN"
paymentDetailsObject✅ RequiredSee PaymentDetails below
itemDetailsArray✅ RequiredList of line items (minimum 1)
customerDetailsObject✅ RequiredCustomer contact information
billingAddressObject✅ RequiredBilling address
shippingAddressObject✅ RequiredShipping address
cardDetailsObjectConditionalManual entry or auto-filled via NFC
returnUrlString✅ RequiredRedirect URL after payment completes
callbackUrlStringOptionalWebhook URL for asynchronous payment status updates
paymentOptionsObjectOptionalReward points and installment configuration

PaymentDetails

FieldTypeRequiredDescription
amountLong✅ RequiredCharge amount in the smallest currency unit
isCustomerPayingFeeBoolean✅ RequiredIndicates whether the customer absorbs the processing fee
transactionDescriptionString✅ RequiredFree-text description displayed on statements
expiredTimeString (ISO-8601)OptionalExpiration timestamp for the payment request

ItemDetails (Array Element)

FieldTypeRequiredDescription
itemIdString✅ RequiredMerchant-defined item identifier
nameString✅ RequiredItem name
amountInt✅ RequiredUnit price (Int, narrower than PaymentDetails.amount)
qtyInt (1–999)✅ RequiredQuantity
descriptionStringOptionalFree-text item description

CustomerDetails

FieldTypeRequiredDescription
emailString✅ RequiredCustomer email
fullNameString✅ RequiredCustomer full name
phoneString✅ RequiredCustomer phone number
ipAddressString✅ RequiredCustomer device IP address

BillingAddress / ShippingAddress

FieldTypeRequiredDescription
fullNameString✅ RequiredRecipient name
phoneString✅ RequiredRecipient phone number
addressString✅ RequiredStreet address
cityString✅ RequiredCity
postalCodeString✅ RequiredPostal / ZIP code
countryString✅ RequiredISO country code (e.g. "ID")

CardDetails

Card information can be filled manually by the user or automatically through autofillFromNfc() after a successful NFC scan.

FieldTypeRequiredDescription
cardNumberString (13–19 digits)ConditionalPAN, spaces are stripped before submission
cardExpiredMonthString (MM)ConditionalTwo-digit expiry month
cardExpiredYearString (YY/YYYY)ConditionalExpiry year
cardCvnString (3–4 digits)ConditionalCard Verification Number (CVN)
cardHolderNameStringConditionalName printed on the card (automatically uppercased by the UI)

PaymentOptions

FieldTypeRequiredDescription
useRewardsBooleanOptionalApply reward point redemption
campaign_codeStringOptionalPromotion / campaign code
tenorString ("0", "3", "6", "12")OptionalInstallment period in months ("0" = full payment)

Responses

This section describes the possible API responses returned by the Payment Gateway.

200 — Success

json
{
  "statusCode": "200",
  "statusMessage": "SUCCESS",
  "data": {
    "transactionId": "TXN-2026016183-001",
    "externalId": "1Ktru19Cp7",
    "paymentStatus": "SUCCESS",
    "link": "https://..."
  }
}

401 — Unauthorized

json
{
  "statusCode": "401",
  "statusMessage": "UNAUTHORIZED",
  "errors": [
    {
      "field": "authorization",
      "message": "Invalid token"
    }
  ]
}

400 — Validation Error

json
{
  "statusCode": "400",
  "statusMessage": "VALIDATION_ERROR",
  "errors": [
    {
      "field": "amount",
      "message": "Must be > 0"
    }
  ]
}

Mapping to PaymentSdkResult

The SDK converts API responses into a unified PaymentSdkResult before invoking the callback to the host application.

Success Response

text
responseCode "00"

PaymentSdkResult(
    isSuccess = true,
    link = data.link
)

Failed Response

text
Any other responseCode

PaymentSdkResult(
    isSuccess = false,
    responseMessage = ...
)

Note

This mapping is identical for:

  • Business-level failures returned with HTTP 200
  • Standard HTTP error responses (400, 401, 500, etc.)

See PaymentViewModel.onSuccessDone() and PaymentViewModel.onFailedDone() (Section 17) for the implementation details.


Error Codes

The following table lists the HTTP status codes that may be returned by the Payment Gateway, along with the recommended handling for each response.

HTTP CodeStatusRecommended Action
400VALIDATION_ERRORFix the validation errors listed in the response, then resubmit the request.
401UNAUTHORIZEDRegenerate the Base64 authorization token. The merchant credentials may be invalid or expired.
409DUPLICATE_ORDERGenerate a new, unused orderId before retrying the request.
422INVALID_CARDAsk the customer to re-enter the card information or perform another NFC scan.
500INTERNAL_ERRORRetry the request. This usually indicates a temporary server-side issue.
503SERVICE_UNAVAILABLERetry the request using an exponential backoff strategy.

iFortepay API Documentation