-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,57 @@ | ||
# SprayPay | ||
SprayPay API client for PHP | ||
SprayPay API client for PHP. | ||
|
||
## Getting started | ||
For usage and allowed parameters please view the official SprayPay API documentation. | ||
|
||
**Initialize client** | ||
``` | ||
$client = new SprayPayApiClient(); | ||
$client->setApiKey('YOUR_API_KEY); | ||
$client->setWebshopId('YOUR_WEBSHOP_ID'); | ||
$client->setTestMode(); | ||
``` | ||
|
||
**Run preflight request** | ||
``` | ||
$response = $client->loanrequestpreflight->preflight([ | ||
'emailAddress' => 'some_email', | ||
'webshopOrderAmount' => '10.00', | ||
'webshopOrderId' => 1, | ||
'webshopCustomerId' => 1, | ||
'returnUrl' => '' | ||
]); | ||
``` | ||
|
||
**Payment/Loan request** | ||
|
||
``` | ||
$loanrequest->create($data, true, true); | ||
``` | ||
|
||
**Get order status** | ||
``` | ||
$this->client->orderstatus->get(1); | ||
``` | ||
|
||
**Create a chargeback request** | ||
``` | ||
$client->chargebackrequest->create([ | ||
'date' => '2020-02-02', | ||
'amount' => '10.00', | ||
'chargebackNotificationUrl' => '', | ||
'orderId' => 1, | ||
'reason' => 'Some reason' | ||
]); | ||
``` | ||
|
||
**Get chargeback request status** | ||
``` | ||
$response = $client->chargebackrequest->getStatus(['reference' => 'SOME_REFERENCE']); | ||
``` | ||
|
||
**Payment resource example** | ||
``` | ||
$payment = new Payment(client->loanrequest->create($data, true, true)); | ||
$payment->isPaid(); | ||
``` |