Data Structures
This page provides a comprehensive look at the various data models used throughout the AFIPAY Merchant API. Each section details the properties, types, descriptions, and example values for the respective models.
Payment
Description: The Payment object represents a payment transaction. It contains details about the payment amount, status, associated transactions, and information regarding both the customer and merchant.
Properties:
-
id (string) AFIPAY payment id. Example:
"285d8dce-7663-4580-ba7f-8afb2f2d3292"
-
transactions (array) An array of transaction objects associated with the payment. Each transaction includes:
-
paymentId (string): Payment id.
-
txnId (string): Unique transaction identifier.
-
receivedAmount (string): The amount received.
-
asset (Asset): Details of the asset used.
-
destTag (string, nullable): Additional tag for coins that require it.
-
addressFrom (string): Merchant’s payment address.
-
addressTo (string): Customer’s payment address.
-
date (string, date-time): Date and time of the transaction.
-
amount (string) The amount of the payment.
-
totalReceivedAmount (string) The total amount received for the payment.
-
asset (Asset) The asset object related to the payment.
-
addressTo (string) The address where the customer needs to send the payment.
-
confirmsNeeded (integer) The number of confirmations required for the payment to be completed.
-
timeout (integer) The expiration time (in seconds) for the payment.
-
checkoutUrl (string) URL to redirect the user after the payment is completed.
-
status (PaymentStatus) The current status of the payment (either
OPEN
orEXPIRED
). -
customer (Customer) Customer details.
-
merchant (Merchant) Merchant details.
-
invoice (string) A custom invoice field for merchant use.
-
paymentRedirectUrl (string) URL to redirect after the payment is created.
-
createdAt (string, date-time) Timestamp of when the payment was created.
-
updatedAt (string, date-time) Timestamp of the last update to the payment.
PaymentStatus
Type: string
Allowed Values:
OPEN
EXPIRED
Example: "OPEN"
Asset
Description: The Asset object represents a cryptocurrency or other asset used in the payment or withdrawal.
Properties:
-
short (string) The short name of the asset (e.g., "USDT").
-
name (string) The full name of the asset (e.g., "Tether").
-
logoUrl (string, URI) URL of the asset's logo.
-
network (string) The network on which the asset operates (allowed values:
ethereum
,tron
).
Example:
{
"short": "USDT",
"name": "Tether",
"logoUrl": "https://cryptologos.cc/logos/tether-usdt-logo.png",
"network": "tron"
}
Withdrawal
Description: The Withdrawal object represents a request for funds withdrawal. It includes details of the withdrawal amount, associated asset, and addresses.
Properties:
-
id (string) AFIPAY withdrawal id.
-
txnId (string) Unique transaction identifier for the withdrawal.
-
amount (string) The requested withdrawal amount.
-
receivedAmount (string) The amount actually received.
-
asset (Asset) The asset used in the withdrawal.
-
addressTo (string) The customer’s address to which funds are sent.
-
addressFrom (string) The merchant’s withdrawal address.
-
destTag (string, nullable) An optional tag for transactions that require it (e.g., for XRP).
-
status (WithdrawalStatus) The current status of the withdrawal.
-
customer (Customer) Customer details.
-
merchant (Merchant) Merchant details.
-
invoice (string) A custom invoice field for merchant use.
-
createdAt (string, date-time) Timestamp of when the withdrawal was created.
-
updatedAt (string, date-time) Timestamp of the last update to the withdrawal.
WithdrawalStatus
Type: string
Allowed Values:
CANCELLED
OPEN
APPROVED
COMPLETE
Customer
Description: The Customer object contains information about the customer involved in the transaction.
Properties:
-
id (integer) Unique identifier for the customer.
-
name (string) The name of the customer.
-
email (string, email) The customer’s email address.
Example:
{
"id": 12312312,
"name": "John Dou",
"email": "[email protected]"
}
Merchant
Description: The Merchant object contains details about the merchant processing the transaction.
Properties:
-
id (string) Unique identifier for the merchant.
-
name (string) The name of the merchant or company.
-
siteUrl (string, URI) The URL of the merchant's website.
-
logoUrl (string, URI) The URL of the merchant's logo.
-
email (string, email) The merchant's email address.
Example:
{
"id": "285d8dce-7663-4580-ba7f-8afb2f2d3292",
"name": "Company Name",
"siteUrl": "company.com",
"logoUrl": "https://example.com/logo.svg",
"email": "[email protected]"
}
ErrorModel
Description: The ErrorModel defines the structure of error responses returned by the API.
Properties:
-
message (string) A description of the error.
-
code (integer) A numeric error code (ranging from 100 to 600).