Page MenuHomePhabricator

Handle Refund/Chargeback IPNS for Dlocal
Closed, ResolvedPublic

Description

Refunding a card payment in the console will create a refund IPN, example:

{
  "id":"REF-2486-6491f08d-4db1-40e3-b66c-09a132f471ee",
  "event_info":{"type":"refund"},
  "payment_id":"T-2486-893758a2-1800-4254-90c3-306992dfb16b",
  "notification_url":"https://paymentsipntest4.wmcloud.org/dlocal",
  "amount":100,
  "currency":"BRL",
  "id_refund":21231387,
  "status":"SUCCESS",
  "status_code":200,
  "status_detail":"The refund was paid.",
  "created_date":"2023-02-28T04:16:23.326+0000",
  "amount_refunded":0,
  "use_orig_fx":false,
  "order_id":"28.1"
}

Chargebacks:
https://docs.dlocal.com/docs/chargebacks#example-post
https://docs.dlocal.com/reference/simulate-chargeback-sandbox-only

{
    "id": "CHAR42342",
    "payment_id": "PAY245235",
    "amount": 100.00,
    "currency": "USD",
    "status": "COMPLETED",
    "status_code": 200,
    "status_detail": "The chargeback was executed.",
    "created_date" : "2018-02-15T15:14:52-00:00",
    "notification_url": "http://merchant.com/notifications",
    "order_id": "merchant_num_123456"
}

Event Timeline

Ejegg updated the task description. (Show Details)
AnnWF removed AnnWF as the assignee of this task.Apr 11 2023, 8:45 PM
AnnWF subscribed.

Change 910610 had a related patch set uploaded (by Cstone; author: Cstone):

[wikimedia/fundraising/SmashPig@master] Add dlocal refund and chargeback ipn handling

https://gerrit.wikimedia.org/r/910610

If you are getting missing auth headers when testing:

Update the Apache config on your fundraising-dev SmashPig container to allow for the auth:

  • docker-compose exec -u root smashpig bash // you need to be root
  • open /etc/apache2/sites-enabled/000-default.conf in your preferred text editor
  • Add CGIPassAuth On to the PublicHttp block
<Directory "/srv/smashpig/PublicHttp">
        Options -Indexes
        AllowOverride all
        Require all granted
	CGIPassAuth On
    </Directory>
  • run service apache2 reload to load in the new config

Change 910610 merged by Wfan:

[wikimedia/fundraising/SmashPig@master] Add dlocal refund and chargeback ipn handling

https://gerrit.wikimedia.org/r/910610

XenoRyet set Final Story Points to 4.