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 calls a routine from our Code Library.
Download BluePay.php
Or, download via GitHub

<?php
/**
* BluePay PHP 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
* get information back on this rebilling cycle.
* See comments below on the details of the initial setup of the
* rebilling cycle.
*/
include('../BluePay.php');
$accountID = "Merchant's Account ID Here";
$secretKey = "Merchant's Secret Key Here";
$mode = "TEST";
$rebill = new BluePay(
   
$accountID,
   
$secretKey,
   
$mode
);
$rebill->setCustomerInformation(array(
   
'firstName' => 'Bob',
   
'lastName' => 'Tester',
   
'addr1' => '1234 Test St.',
   
'addr2' => 'Apt #500',
   
'city' => 'Testville',
   
'state' => 'IL',
   
'zip' =>'54321',
   
'country' => 'USA',
   
'phone' => '1231231234',
   
'email' => '[email protected]'
));
 
$rebill->setCCInformation(array(
   
'cardNumber' => '4111111111111111', // Card Number: 4111111111111111
   
'cardExpire' => '1225', // Card Expire: 12/25
   
'cvv2' => '123' // Card CVV2: 123
));
$rebill->setRebillingInformation(array(
  
'rebillFirstDate' => '2015-01-05', // Rebill Start Date: Jan. 5, 2015
  
'rebillExpression' => '1 MONTH', // Rebill Frequency: 1 MONTH
  
'rebillCycles' => '5', // Rebill # of Cycles: 5
  
'rebillAmount' => '3.50' // Rebill Amount: $3.50
));
$rebill->auth('0.00');
// Makes the API Request to create a recurring payment
$rebill->process();
// If transaction was approved..
if ($rebill->isSuccessfulResponse()) {
   
$rebillStatus = new BluePay(
       
$accountID,
       
$secretKey,
       
$mode);
   
// Find the rebill by ID and get rebill status
   
$rebillStatus->getRebillStatus($rebill->getRebillID());
   
// Makes the API Request to get the rebill status
   
$rebillStatus->process();
   
// Read response from BluePay
   
echo
   
'Rebill Status: ' . $rebillStatus->getRebStatus() . "\n" .
   
'Rebill ID: ' . $rebillStatus->getRebID() . "\n" .
   
'Template ID: ' . $rebillStatus->getTemplateID() . "\n" .
   
'Rebill Creation Date: ' . $rebillStatus->getCreationDate() . "\n" .
   
'Rebill Next Date: ' . $rebillStatus->getNextDate() . "\n" .
   
'Rebill Last Date: ' . $rebillStatus->getLastDate() . "\n" .
   
'Rebill Expression: ' . $rebillStatus->getSchedExpr() . "\n" .
   
'Rebill Cycles Remaining: ' . $rebillStatus->getCyclesRemaining() . "\n" .
   
'Rebill Amount: ' . $rebillStatus->getRebAmount() . "\n" .
   
'Rebill Next Amount Charged: ' . $rebillStatus->getNextAmount();
} else {
    echo
$rebill->getMessage();
}
?>
Can’t find what you’re
looking for? We can help.

Contact 800-350-2684 for Integration Support.

  • Microsoft Gold Partner Badge
  • Susan G. Komen for the Cure Supporter
  • 2018 American Business Awards Gold Stevie® Winner Badge for Best Payment and Electronic Commerce Solution
  • 2018 CNP Awards Customer Choice Winner Badge for Best E-Commerce Platform/Gateway
  • 2017 TSG Gateway Awards Winner Badge for Best Onboarding Process
  • Best in Biz Awards 2018 Silver Winner Badge for Business Development Department of the Year
BluePay Processing, LLC is a registered ISO of Wells Fargo Bank, N.A., Concord, CA, 94524 U.S.A.
BluePay Canada ULC, is a Registered ISO/MSP of Peoples Trust Company, Vancouver, Canada.