Get a Recurring Payment Status

This code steps you through the process of establishing a rebilling transaction for the purpose of assigning a Transaction ID. You can then use this Transaction ID to check the status of rebilling in the future.

This code uses BluePay's Rebilling Administration Interface.
For documentation on usage of this interface Go to: Library documentation

You can test for both outcomes:

Approved: When you pass odd dollar amounts, this returns an 'Approved' status.
Declined: When you pass even dollar amounts, this returns a 'Declined' status.

The following sample code makes use of various headers and source files.
Download bluepay-cpp.zip
Or, download via GitHub

//
// BluePay C++ Sample code.
//
// This code sample runs a $0.00 Credit Card Auth transaction
// against a customer using test payment information.
// Once the rebilling cycle is created, this sample shows how to
// update the rebilling cycle. See comments below
// on the details of the initial setup of the rebilling cycle as well as the
// updated rebilling cycle.


#include "Update_Recurring_Payment.h"
#include "BluePay.h"
using namespace std;

void updateRecurringPayment(){
    string accountId = "Merchant's Account ID Here";
    string secretKey = "Merchant's Secret Key Here";
    string mode = "TEST";

    BluePay rebill(
        accountId,
        secretKey,
        mode
    );

    rebill.setCustomerInformation(
        "Bob", // First Name
        "Tester", // Last Name
        "12345 Test St.", // Address1
        "Apt #500", // Address2
        "Testville", // City
        "IL", // State
        "54321", // Zip
        "USA", // Country
        "1231231234", // Phone Number
        "[email protected]" // Email Address
      );

    rebill.setCCInformation(
        "4111111111111111", // Card Number
        "1215", // Card Expire
        "123" // Card CVV2
    );

    rebill.setRebillingInformation(
        "15.00", // Rebill Amount: $3.50
        "2015-01-01", // Rebill Start Date: Jan. 5, 2015
        "1 MONTH", // Rebill Frequency: 1 MONTH
        "12" // Rebill # of Cycles: 5
    );

    // Auth Amount: $0.00
    rebill.auth("0.00");
   
    // Makes the API Request with Blue
    rebill.process();


    // Reads the responses from BluePay if transaction was approved
    if (rebill.isSuccessfulTransaction()){
   
        BluePay rebillUpdate(
            accountId,
            secretKey,
            mode
        ); 

        // Updates the rebill
        rebillUpdate.updateRebillingInformation(
            rebill.getRebillId(), // The ID of the rebill to be updated
            "2015-03-01", // Rebill Start Date: March 1, 2015
            "1 MONTH", // Rebill Frequency: 1 MONTH
            "8", // Rebill # of Cycles: 8
            "5.15", // Rebill Amount: $5.15
            "1.50" // Rebill Next Amount: $1.50
        );

        // Makes the API Request with Blue
        rebillUpdate.process();

        // Reads the responses from BluePay
        cout << string("Rebill Status: ") + rebill.getResult() + "\n";
        cout << string("Rebill ID: ") + rebillUpdate.getRebillId() + "\n";
        cout << string("Rebill Creation Date: ") + rebillUpdate.getCreationDate() + "\n";
        cout << string("Rebill Next Date: ") + rebillUpdate.getNextDate() + "\n";
        cout << string("Rebill Last Date: ") + rebillUpdate.getLastDate() + "\n";
        cout << string("Rebill Schedule Expression: ") + rebillUpdate.getSchedExpr() + "\n";
        cout << string("Rebill Cycles Remaining: ") + rebillUpdate.getCyclesRemain() + "\n";
        cout << string("Rebill Amount: ") + rebillUpdate.getRebillAmount() + "\n";

    }
    else {
        cout << string("Error: ") + rebill.getMessage();
    }
}
Can’t find what you’re
looking for? We can help.

Contact 800-350-2684 for Integration Support.

BluePay Processing, LLC is a registered ISO of Wells Fargo Bank, N.A., Walnut Creek, CA, U.S.A.
BluePay Canada ULC, is a Registered ISO/MSP of Peoples Trust Company, Vancouver, Canada.