Skip to main content
POST
Cancel an affiliate sale
Cancels a sale you reported to Growi from your website or your iOS or Android app. Call it from your backend when an order is refunded: a website order you refunded, an App Store refund or a Google Play voided purchase. It works the same way a Shopify refund cancels a Shopify sale: the sale is marked cancelled, its full amount and commission count as refunded, and it stops counting toward the brand’s revenue, the creator’s commission and creator payouts. The creator sees it as cancelled.

Request body

Behavior

  • Call it from your server. The API key must never reach a browser or an app.
  • Website, iOS and Android only. Shopify sales are cancelled automatically when the order is refunded in Shopify, so shopify is rejected here.
  • Full cancel only. The whole sale is cancelled and the creator’s full commission on it is removed. Partial refunds are not supported: if only part of an order is refunded, decide whether to cancel the sale or leave it.
  • Safe to retry. Cancelling a sale that is already cancelled changes nothing and returns 200 with result: "already_cancelled".
  • Already paid sales. A sale whose commission was already paid is cancelled the same way, as with a Shopify refund. Growi does not take money back from creators. To protect yourself, ask Growi to set a payout delay on the campaign that covers most of your refund window.
  • Only your own sales. Orders are matched to your organization and to the platform you send. An order id from another organization, from another platform or from your Shopify store returns 404.
  • Rate limits. Counts toward your normal API budget, including the 2-second spacing. On 429, wait Retry-After seconds and send again.

When to call it

Website orders

When you refund an order on your website, send the same order_id you used for that sale with conversion_platform: "website".

Apple: App Store Server Notifications

  1. In App Store Connect, set your App Store Server Notifications URL (version 2) to an endpoint on your server.
  2. When a notification arrives with notificationType = REFUND, verify and decode signedPayload, then decode data.signedTransactionInfo.
  3. Send the same id you sent as order_id in payment_completed for that purchase. If you sent transactionId, send the refunded transaction’s transactionId. If you sent originalTransactionId, send that. Growi keeps one sale per order_id, so if you used one id for a whole subscription, any refund on it cancels that one sale.
REFUND_REVERSED (Apple undid a refund) is not handled by this endpoint. Contact Growi support if it happens.

Google Play: voided purchases

Poll the Voided Purchases API (purchases.voidedpurchases.list) from your server, for example once a day. It lists refunded, charged back and revoked purchases. For each one, send its orderId (the same GPA. order id you sent as order_id in payment_completed).

Response

Response example

commission is the original commission on the sale. The creator is no longer owed it once the sale is cancelled.

Errors

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
conversion_platform
enum<string>
required

The platform you created the sale with: website, ios or android. Shopify sales are cancelled by Shopify refunds, not by this endpoint

Available options:
website,
ios,
android
order_id
string
required

The same order_id you sent when the sale was created (in payment_completed or Create affiliate sale), for example your website order id, Apple's transactionId or the Google Play orderId

Example:

"2000000812345678"

Response

The sale is cancelled (by this request, or already before it)

success
boolean
required
Example:

true

result
enum<string>
required

cancelled: this request cancelled the sale. already_cancelled: it was cancelled before and nothing changed

Available options:
cancelled,
already_cancelled
order_id
string
required
Example:

"2000000812345678"

message
string
required
Example:

"Sale cancelled."

affiliate_sale
object
required