Export Subscription Offer

This function can be used to export and get information of a subscription offer.


HTTP Method API URL API Version
GET https://api.payzone.ma/subscription/offer/{offerID} >= 002

Accepted parameters

No extra parameter is needed.

Code samples

Note: Gateway API transactions are done with a different library than payment-page API. See the code sample comments for more info:

    *   Transaction name is 'ExportSubscriptionOffer', once you create a new transaction passing this as parameter, 
    *   you need to set the mandatory data using the following method:
    *    setOfferID()

    $client = new GatewayClient();

    $transaction = $client->newTransaction('ExportSubscriptionOffer', 'testMerchant', 'testPassword');

    $response = $transaction->send();

    if ('000' === $response->errorCode) {
        $offer = $response->offer;
    } else {
        echo "Error {$response->errorCode} with message {$response->errorMessage}";
    PaymentGatewayConnector connector = new PaymentGatewayConnector(API_URL, ORIGINATOR, PASSWORD);

    SubscriptionOfferExportResponse response = null;
    SubscriptionOfferExportRequest request = new SubscriptionOfferExportRequest();

    try {
        response = connector.getSubscriptionOffer(request);
    } catch (Exception e) {

    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());
   const gateway = require("payxpert")("123456", "GreatP4ssw0rd").gateway;
    let responseExportOffer = await gateway.exportSubscriptionOffer("111....");

    if (responseExportOffer.code == "000") {
        // Success
        // offer-related data will be in responseExportOffer.offer field

    var client = new GatewayClient(OriginatorConfig.ORIGINATOR_ID, OriginatorConfig.ORIGINATOR_PASSWORD);
    var exportSubscriptionOffer = client.ExportSubscriptionOfferTransaction(offerID);
    var offerResponse = await exportSubscriptionOffer.Send();

    // in offerResponse.offer object you will be able to see all information related to offer


The body of the response is in JSON format.

The following fields are present in the response :

Name Type Description
errorCode String See API Response Codes
errorMessage String See API Response Codes
offer Object The Offer object (see below).

Field Type Max Length Required Description Version
offerID Integer   yes The ID of the offer  
originatorID Integer   yes The ID of the originator owning this offer.  
name String 32 no The name of the offer  
description String 512 no The description of the offer  
state String 32 yes The state of the offer (enabled or disabled).  
subscriptionType String 32 yes The type of subscriptions the offer will produce (normal, partpayment, infinite, lifetime or onetime). See Subscription Types  
currency String 3 no The ISO-4217 currency code for the subscriptions based on this offer (if empty, subscriptions can have any supported currency).  
trialAmount Integer   no Amount for the trial period if any.  
trialPeriod String 10 no Duration of the trial period (if any) in ISO 8601 duration format.  
rebillAmount Integer   yes Amount of the subscription iterations.  
rebillPeriod String 10 yes Frequency of the iterations in ISO 8601 duration format.  
rebillMaxIteration Integer   yes Maximum number of iterations (excluding the initial transaction).  
discountAmount Integer   no Amount for the discount period (not yet supported).  
discountPeriod String 20 no Duration of the discount period in ISO 8601 duration format (not yet supported).  

© Payzone | 2023