Skip to main content

refund Method

Overview

The refund method returns funds to a customer's payment method after a successful payment.

Business Use Case: A customer returns an item. Process a refund to return their money.

Purpose

ScenarioBenefit
Product returnsRefund for returned merchandise
Service cancellationRefund for unrendered services

Request Fields

FieldTypeRequiredDescription
merchantRefundIdstringYesYour unique refund reference
connectorTransactionIdstringYesThe connector's transaction ID
refundAmountMoneyNoAmount to refund (omit for full)
reasonstringNoReason for refund

Response Fields

FieldTypeDescription
merchantRefundIdstringYour reference
connectorRefundIdstringConnector's refund ID
statusRefundStatusPENDING, SUCCEEDED, FAILED
refundAmountMoneyRefund amount
statusCodeintHTTP status code

Example

SDK Setup

use OrchestratorXPrism\PaymentClient;

$paymentClient = new PaymentClient([
'connector' => 'stripe',
'apiKey' => 'YOUR_API_KEY',
'environment' => 'SANDBOX'
]);

Request

$request = [
'merchantRefundId' => 'refund_001',
'connectorTransactionId' => 'pi_3Oxxx...',
'refundAmount' => [
'minorAmount' => 1000,
'currency' => 'USD'
],
'reason' => 'Customer returned item'
];

$response = $paymentClient->refund($request);

Response

[
'merchantRefundId' => 'refund_001',
'connectorRefundId' => 're_3Oxxx...',
'status' => 'PENDING',
'refundAmount' => [
'minorAmount' => 1000,
'currency' => 'USD'
],
'statusCode' => 200
]

Next Steps