POST
/
v1
/
refunds
/
PHP (SDK)
declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Components;

$sdk = Polar\Polar::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Components\RefundCreate(
    orderId: '<value>',
    reason: Components\RefundReason::CustomerRequest,
    amount: 90,
);

$response = $sdk->refunds->create(
    request: $request
);

if ($response->refund !== null) {
    // handle response
}
{
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "metadata": {},
  "status": "pending",
  "reason": "duplicate",
  "amount": 123,
  "tax_amount": 123,
  "currency": "<string>",
  "organization_id": "<string>",
  "order_id": "<string>",
  "subscription_id": "<string>",
  "customer_id": "<string>",
  "revoke_benefits": true
}

Authorizations

Authorization
string
header
required

You can generate an Organization Access Token from your organization's settings.

Body

application/json

Response

200
application/json

Successful Response

The response is of type object.