palbaseDocs

Palbase Payments · API

POST/payments/splits/{split_id}/refund

Refund marketplace payment split

Executes an item-level partial or full marketplace split refund (iyzico v1 paymentTransactionId refund or Stripe refund + Transfer Reversal). A refund is held to what is left of the split and of its payment (409 refund_exceeds_split, 409 refund_exceeds_remaining). Asked again under the same Idempotency-Key — for the same amount — it answers the refund it wrote, with replayed: true, and the provider is not asked again; for another amount it answers 409 idempotency_key_reused. On Stripe, what a transfer already sent the seller is taken back with the refund, whatever its destination, up to what was sent; what is not taken back that way is their debt. Of a split paid out already, a refund takes off what the seller was paid only what the provider took back — a transfer reversed; of iyzico, a card's refund's share — and the rest is their debt. A refund to a wallet of money (kind: fiat) answers 422 marketplace_fiat_wallet_forbidden unless the project lets marketplace payments fill it (allow_marketplace_fiat_wallet). A split whose payment never went through answers 409 intent_not_refundable. A refund its provider failed answers 409 refund_failed, and nothing is written; one the provider has taken and not finished yet is counted as given. A provider is not asked twice for the same money. A refund the provider did not answer — in time, or so it could be read — answers 502 provider_unavailable and may have been made: until it is known, every refund of the payment answers 409 refund_pending. On Stripe the same Idempotency-Key, sent again within a day, asks again and is the same refund (Stripe answers a key with what it answered the first time, a failure of its own too); otherwise say what the provider did with POST /payments/intents/{intent_id}/pending-refund. A split refunded in part before it is approved is approved for what is left of it. A refund with destination: outside is of money the project gave the buyer itself: no money of the payment moves, and the payment is not counted refunded. Of an iyzico item not approved yet, what it pays its sub-merchant is lowered first — to a kuruş at least — and the refund is written once iyzico takes it; a failure that says nothing lasting is not known (502 provider_unavailable), and nothing is written — what iyzico holds of the item is read, and an item still not lowered after three failures, half an hour from the first, is one iyzico will not lower; one that had a card's refund iyzico lowers no more (its share is kept without asking). A refund to the wallet takes the seller's share off an iyzico item not approved yet as one given outside does; asked by the amounts by name, its share is kept: the seller's debt once the item is approved. What each refund takes back of the seller's share is of the split's own escrow and top-up; once approved, what the provider pays past what is released (a share iyzico would not take off its item) is the seller's debt, set against a later approval only by the platform's top-up it withholds; a Stripe transfer sends the whole of what is released. One iyzico did not answer is 502 provider_unavailable: the same request, under its Idempotency-Key, finishes it, and so does the split's next refund or approval, from what iyzico holds of the item; while iyzico still does not answer they answer 409 refund_pending. An item iyzico will not lower — one with a refund of its own — pays its seller whole once approved, and the seller's share is their debt in the books. An iyzico item given back whole by a refund that lowered it — given outside or to the wallet — is approved all the same: what iyzico holds of it, the kuruş left to its seller aside, is the platform's. One iyzico would not lower, or one made whole by a card's refund, given back whole, is not approved. Asked again under its key, the refund is the one of the amount first asked; another amount is 409 idempotency_key_reused, and so is the key of another split's refund given outside and not finished. A sale its seller made at a loss — the split's seller_deficit_amount, the debt it wrote them — gives that debt back with it as the fee is, in proportion to what was given back so far (seller_deficit_reversed_amount). Said of more than is left of the split, it is held to what is left (outside_refund_amount); of a split given back whole, 409 split_not_refundable. A split whose approval was cut short is made whole first: while its provider does not answer, 409 approval_pending — ask again under the same Idempotency-Key.

Called by your server, with the project's secret key.

Path

split_idstring · requiredPayment split UUID.

Request body

amountinteger (int64) · optionalWhat the buyer is given back of this split, given alone: payments works out the rest from the split's own amounts — to the card first, as far as the card paid and was not given back, the rest to the wallet; and what the seller, the platform's fee, the tax withheld and the platform's discount each give back, each the share of its whole that the split's refunds so far are of what the buyer paid. A split refunded in parts gives back exactly its own amounts.
card_refund_amountinteger (int64) · optionalCard amount to refund to buyer.
destination"original" | "wallet" | "outside" · optionalWith amount: original (the default), wallet — the whole of it to the buyer's wallet — or outside: the project gave the buyer the money itself (its card's refund was refused for good), nothing goes back through the platform, and the seller, the platform's fee and the tax withheld give back their shares all the same. An iyzico item not paid to its seller yet pays that much less; a Stripe transfer is made of what is left, or taken back once made; a seller paid already owes it in the books.
platform_fee_reversed_amountinteger (int64) · optionalCommission fee reversed.
reasonstring · optionalOptional refund reason.
seller_clawback_amountinteger (int64) · optionalAmount clawed back from seller escrow, payable, or debt.
seller_deficit_reversed_amountinteger (int64) · optionalOf a refund by name: what it gives back of the debt a sale its seller made at a loss wrote them (the split's seller_deficit_amount). Unnamed, none is given back; named past what is left of it, what is left.
subsidy_reversed_amountinteger (int64) · optionalPlatform subsidy reversed.
wallet_refund_amountinteger (int64) · optionalWallet amount to refund to buyer.
withholding_tax_reversed_amountinteger (int64) · optionalWithholding tax reversed.
curl
curl -X POST "https://<your-ref>.palbase.studio/payments/splits/<split_id>/refund" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"amount":0,"card_refund_amount":0,"destination":"original","platform_fee_reversed_amount":0,"reason":"string","seller_clawback_amount":0,"seller_deficit_reversed_amount":0,"subsidy_reversed_amount":0,"wallet_refund_amount":0,"withholding_tax_reversed_amount":0}'

Responses

201Split refunded

defaultStandard Palbase JSON error envelope (`error` and `error_description`).

Operation RefundPaymentSplit of payments's contract.