Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle CONSUMPTION_REQUEST notification in iOS in app purchase

Per ios doc

The App Store uses a variety of factors to determine if a refund request is approved or denied. To help inform and improve the refund process, you can send information about a user’s consumption of an in-app purchase to the App Store when the user requests a refund. The App Store uses the consumption information you provide to inform its refund decisions.

When a customer initiates a refund request for a consumable in-app purchase, the App Store sends a CONSUMPTION_REQUEST notification_type to your server through App Store Server Notifications. If the customer provided consent, respond by calling this API and sending the consumption data in the ConsumptionRequest to the App Store. If not, respond by calling this API and setting the customerConsented value to false in the ConsumptionRequest; don't send any other information.

Now we got a CONSUMPTION_REQUEST notification_type and the content is

{Environment:PROD 
 NotificationType:CONSUMPTION_REQUEST 
 Password:xxxx0b91b407f5xxxxxxxxx 
 ExpirationIntent: 
 AutoRenewAdamID: 
 AutoRenewStatus: 
 AutoRenewProductID:
 AutoRenewStatusChangeDate:{AutoRenewStatusChangeDate: AutoRenewStatusChangeDateMS: AutoRenewStatusChangeDatePST:} 
 BID:com.boundle.id
 BVRS:89 
 UnifiedReceipt:{
    Status:0 
    Environment:Production 
    LatestReceipt:MIISegYJKoZIhvcNXXXXXXXXXX 
 LatestReceiptInfo:[] 
 PendingRenewalInfo:[]
 }
}

It seems there is no receipt transaction id which the customer asks for a refund.

And then we try to get the receipt details through https://buy.itunes.apple.com/verifyReceipt with LatestReceipt of notification

{ receipt:
   { receipt_type: 'Production',
     adam_id: 125258871623,
     app_item_id: 125258871623,
     bundle_id: 'com.boundle.id',
     application_version: '89',
     download_id: null,
     version_external_identifier: 843111111,
     receipt_creation_date: '2021-07-18 04:48:20 Etc/GMT',
     receipt_creation_date_ms: '1626583700000',
     receipt_creation_date_pst: '2021-07-17 21:48:20 America/Los_Angeles',
     request_date: '2021-07-20 08:02:21 Etc/GMT',
     request_date_ms: '1626768141824',
     request_date_pst: '2021-07-20 01:02:21 America/Los_Angeles',
     original_purchase_date: '2021-07-07 00:03:57 Etc/GMT',
     original_purchase_date_ms: '1625616237000',
     original_purchase_date_pst: '2021-07-06 17:03:57 America/Los_Angeles',
     original_application_version: '87',
     in_app: [] },
  environment: 'Production',
  status: 0 }
{ receipt_type: 'Production',
  adam_id: 125258871623,
  app_item_id: 125258871623,
  bundle_id: 'com.boundle.id',
  application_version: '89',
  download_id: null,
  version_external_identifier: 843111111,
  receipt_creation_date: '2021-07-18 04:48:20 Etc/GMT',
  receipt_creation_date_ms: '1626583700000',
  receipt_creation_date_pst: '2021-07-17 21:48:20 America/Los_Angeles',
  request_date: '2021-07-20 08:02:21 Etc/GMT',
  request_date_ms: '1626768141824',
  request_date_pst: '2021-07-20 01:02:21 America/Los_Angeles',
  original_purchase_date: '2021-07-07 00:03:57 Etc/GMT',
  original_purchase_date_ms: '1625616237000',
  original_purchase_date_pst: '2021-07-06 17:03:57 America/Los_Angeles',
  original_application_version: '87',
  in_app: [] }

There is no refund receipt info either.

Per doc, once received CONSUMPTION_REQUEST, we should send Consumption Information through API

PUT https://api.storekit.itunes.apple.com/inApps/v1/transactions/consumption/{originalTransactionId}

How could we get the originalTransactionId from notification?

like image 810
zangw Avatar asked Nov 30 '25 09:11

zangw


1 Answers

On my case, there is original_transaction_id in the top level properties of the notification payload.

like image 168
Miftah Fathudin Avatar answered Dec 02 '25 01:12

Miftah Fathudin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!