forked from ATouhou/altapay-php-api
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from AltaPay/charge-subscription-transaction-info
Charge subscription transaction info
- Loading branch information
Showing
5 changed files
with
63 additions
and
3 deletions.
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
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
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,56 @@ | ||
[<](../index.md) Altapay - PHP Api - Charge subscription | ||
===================================================== | ||
|
||
Use the chargeSubscription method to capture a single occurrence of a recurring payment, for example a monthly subscription payment. | ||
|
||
- [Request](#request) | ||
+ [Required](#required) | ||
+ [Optional](#optional) | ||
+ [Example](#example) | ||
- [Response](#response) | ||
|
||
# Request | ||
|
||
```php | ||
$request = new \Altapay\Api\Subscription\ChargeSubscription($auth); | ||
// Do the call | ||
try { | ||
$response = $request->call(); | ||
// See Response below | ||
} catch (\Altapay\Exceptions\ClientException $e) { | ||
// Could not connect | ||
} catch (\Altapay\Exceptions\ResponseHeaderException $e) { | ||
// Response error in header | ||
$e->getHeader()->ErrorMessage | ||
} catch (\Altapay\Exceptions\ResponseMessageException $e) { | ||
// Error message | ||
$e->getMessage(); | ||
} | ||
``` | ||
|
||
### Required | ||
|
||
| Method | Description | Type | | ||
|---|---|---| | ||
| setTransaction(string) | The id of the setup agreement transaction. | | ||
|
||
### Optional | ||
|
||
| Method | Description | Type | | ||
|---|---|---| | ||
| setAmount(float) | The amount to capture. | float| | ||
| setTransactionInfo(array) | This is a one-dimensional associative array. This is where you put any value that you would like to bind to the payment. | array | ||
| setOrderLines(array or OrderLine) | Order lines | array of OrderLine objects - [See OrderLine](../request/orderline.md) | ||
|
||
### Example | ||
|
||
```php | ||
$request = new \Altapay\Api\Subscription\ChargeSubscription($auth); | ||
$request->setTransaction('12345678'); | ||
``` | ||
|
||
# Response | ||
|
||
``` | ||
$response = $request->call(); | ||
``` |
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
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