Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
webhooks 文档
Browse files Browse the repository at this point in the history
  • Loading branch information
Phx committed Dec 27, 2016
1 parent 8cbd0ce commit b565417
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ $cancel->setTransactionReference('batch_no_20160801001');
$response = $cancel->send();
```

### Fetch Event (查询Event事件)
### Fetch Event (查询 Event 事件)
```php
/**
* @var \Omnipay\Pingpp\Message\FetchEventRequest $event
Expand All @@ -380,6 +380,27 @@ $event->setEventReference('evt_lqVSy5gbL0A68pS8YKvJzdWZ');
$response = $event->send();
```

## Webhooks

To configure your webhooks URL, simply login Ping++ Dashboard, for more information, check out: [docs](https://www.pingxx.com/docs/webhooks/webhooks)

Code below shows how you can verify whether the webhooks you receive is sent by Ping++:

```php
// Retrieve signature in header
$signature = $headers['X-Pingplusplus-Signature'] ?: null;

// Get the Ping++ RSA Public Key in Dashboard
$pub_key_contents = file_get_contents(__DIR__ . "/pingpp_rsa_public_key.pem");

if (openssl_verify(file_get_contents('php://input'), base64_decode($signature), $pub_key_contents, 'sha256')) {
// Congrats! This request is from Ping++
exit;
}

http_response_code(400);
```

## pingpp.js

The minimum integration for PC payment is simple, first you need to load [pingpp.js](https://github.com/PingPlusPlus/pingpp-js/blob/master/dist/pingpp.js) ,
Expand Down

0 comments on commit b565417

Please sign in to comment.