This function can be used to export and get information of a subscription offer.
API Url
Environment | Url | Method | Version |
---|---|---|---|
Production | https://api.payxpert.com/subscription/offer/{offerID} | GET | >= 0202 |
Export Subscription Offer Request
No extra parameter is needed.
Export Subscription Offer Response
Field | Type | Max Length | Requirement | Description | Version |
---|---|---|---|---|---|
errorCode | D | 3 | M | See Messages and error codes | |
errorMessage | S | 100 | M | See Messages and error codes | |
offer | O | O | The Offer object (see below). |
The offer object
This object represent the offer and contains the following fields:
Field | Type | Max Length | Requirement | Description | Version |
---|---|---|---|---|---|
offerID | N | M | The ID of the offer | ||
originatorID | N | M | The ID of the originator owning this offer. | ||
name | S | 32 | O | The name of the offer | |
description | S | 512 | O | The description of the offer | |
state | C | 32 | M | The state of the offer (enabled or disabled). | |
subscriptionType | C | 32 | M | The type of subscriptions the offer will produce (normal, infinite, lifetime or onetime) | |
currency | C | 3 | O | The ISO-4217 currency code for the subscriptions based on this offer (if empty, subscriptions can have any supported currency). | |
trialAmount | N | O | Amount for the trial period if any. | ||
trialPeriod | AN | 10 | O | Duration of the trial period (if any) in ISO 8601 duration format. | |
rebillAmount | N | M | Amount of the subscription iterations. | ||
rebillPeriod | S | 10 | M | Frequency of the iterations in ISO 8601 duration format. | |
rebillMaxIteration | N | M | Maximum number of iterations (excluding the initial transaction). | ||
discountAmount | N | O | Amount for the discount period (not yet supported). | ||
discountPeriod | S | 20 | O | Duration of the discount period in ISO 8601 duration format (not yet supported). |
PHP Gateway Client
Transaction name : ExportSubscriptionOffer
PHP Methods
Method name | Requirement |
---|---|
setOfferID | M |
PHP Example
<?php
$client = new GatewayClient();
$transaction = $client->newTransaction('ExportSubscriptionOffer', 'testMerchant', 'testPassword');
$transaction->setOfferID(145678);
$response = $transaction->send();
if ('000' === $response->errorCode) {
$offer = $response->offer;
} else {
echo "Error {$response->errorCode} with message {$response->errorMessage}";
}
?>
Java Gateway Client
Java Methods
Connector method | getSubscriptionOffer |
---|---|
Request class | SubscriptionOfferExportRequest |
Response class | SubscriptionOfferExportResponse |
Java Examples
PaymentGatewayConnector connector = new PaymentGatewayConnector(API_URL, ORIGINATOR, PASSWORD);
SubscriptionOfferExportResponse response = null;
SubscriptionOfferExportRequest request = new SubscriptionOfferExportRequest();
request.setOfferId(23456L);
try {
response = connector.getSubscriptionOffer(request);
} catch (Exception e) {
e.printStackTrace();
}
if (response != null) {
if (TransactionResultCode.TRANSACTION_SUCCESSFULLY.equals(response.getErrorCode()) {
System.out.println("Success: " + response.getErrorMessage());
System.out.println("Offer Name: " + response.getOffer().getName());
System.out.println("Offer Description: " + response.getOffer().getDescription());
} else {
System.out.println("Failure: " + response.getErrorMessage());
}
}