Skip to main content

Get Conditional Payment

Retrieves the conditional payment associated with a payment intent.

Endpoint

GET /v1/payment-intents/:intentId/conditional-payment

Authentication

Requires API key authentication.

Path Parameters

ParameterTypeRequiredDescription
intentIdstringYesThe ID of the payment intent

Request Example

curl https://sandbox.pg.api.finternetlab.io/v1/payment-intents/intent_2xYz9AbC123/conditional-payment \
-H "X-API-Key: sk_test_your_key_here"

Response

Returns the conditional payment object if the payment intent is of type DELIVERY_VS_PAYMENT.

{
"id": "conditional_payment_abc123",
"object": "conditional_payment",
"data": {
"id": "conditional_payment_abc123",
"paymentIntentId": "intent_2xYz9AbC123",
"orderId": "1234567890",
"merchantId": "merchant_abc123",
"contractAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f42318",
"buyerAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f42318",
"tokenAddress": "0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8",
"amount": "1000.00",
"deliveryPeriod": 2592000,
"deliveryDeadline": "1735689600",
"expectedDeliveryHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"actualDeliveryHash": null,
"autoReleaseOnProof": true,
"deliveryOracle": "0x0000000000000000000000000000000000000000",
"releaseType": "DELIVERY_PROOF",
"timeLockUntil": null,
"orderStatus": "PENDING",
"settlementStatus": "NONE",
"disputeWindow": "604800",
"disputeRaisedAt": null,
"disputeReason": null,
"disputeRaisedBy": null,
"createTxHash": "0xabc123...",
"releasedAt": null,
"settlementScheduledAt": null,
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z"
}
}

Response Fields

FieldTypeDescription
idstringUnique identifier for the conditional payment
paymentIntentIdstringAssociated payment intent ID
orderIdstringContract order ID (BigInt as string)
merchantIdstringMerchant account ID
contractAddressstringConditional payment contract address
buyerAddressstringBuyer's wallet address
tokenAddressstringERC-20 token address
amountstringConditional payment amount as decimal string
deliveryPeriodintegerDelivery period in seconds
deliveryDeadlinestringUnix timestamp deadline (BigInt as string)
expectedDeliveryHashstringExpected delivery proof hash (bytes32)
actualDeliveryHashstringActual delivery proof hash (if submitted)
autoReleaseOnProofbooleanWhether to auto-release on delivery proof
deliveryOraclestringDelivery oracle address (optional)
releaseTypestringRelease type: DELIVERY_PROOF, TIME_LOCKED, MILESTONE_LOCKED, AUTO_RELEASE
timeLockUntilstringUnix timestamp for time-locked release (if applicable)
orderStatusstringOrder status: PENDING, SHIPPED, DELIVERED, COMPLETED, CANCELLED, DISPUTED
settlementStatusstringSettlement status: NONE, SCHEDULED, EXECUTED, CONFIRMED, CANCELLED
disputeWindowstringDispute window in seconds (BigInt as string)
disputeRaisedAtstringWhen dispute was raised (Unix timestamp)
disputeReasonstringReason for dispute
disputeRaisedBystringAddress that raised the dispute
createTxHashstringTransaction hash that created the order
releasedAtstringWhen funds were released (Unix timestamp)
settlementScheduledAtstringWhen settlement was scheduled (Unix timestamp)

Error Responses

Payment Intent Not Found

{
"error": {
"code": "resource_missing",
"message": "Payment intent not found",
"type": "invalid_request_error"
}
}

Status Code: 404 Not Found

Not a Conditional Payment

{
"error": {
"code": "invalid_request",
"message": "Payment intent is not of type DELIVERY_VS_PAYMENT",
"type": "invalid_request_error"
}
}

Status Code: 400 Bad Request

This occurs when the payment intent is not a conditional payment.

Conditional Payment Not Found

{
"error": {
"code": "resource_missing",
"message": "Conditional payment not found for this payment intent",
"type": "invalid_request_error"
}
}

Status Code: 404 Not Found

Code Examples

JavaScript/TypeScript

const response = await fetch(
`https://sandbox.pg.api.finternetlab.io/v1/payment-intents/${intentId}/conditional-payment`,
{
headers: {
'X-API-Key': process.env.FINTERNET_API_KEY,
},
}
);

const conditionalPayment = await response.json();
console.log('Order status:', conditionalPayment.data.orderStatus);
console.log('Release type:', conditionalPayment.data.releaseType);

Python

import requests

response = requests.get(
f'https://sandbox.pg.api.finternetlab.io/v1/payment-intents/{intent_id}/conditional-payment',
headers={'X-API-Key': os.environ['FINTERNET_API_KEY']}
)

conditional_payment = response.json()
print('Order status:', conditional_payment['data']['orderStatus'])