Recurly paginate all transactions

305 views Asked by At

I can't get the pagination for the transaction list from Recurly to work properly, it always seem to return the entire list of transactions instead of just page 1 with 15 transactions.

My code:

<?php

try {
// Get all successful transactions
$transactions = Recurly_TransactionList::getSuccessful([ 'per_page' => 15, 'type' => 'purchase' ]);



foreach( $transactions as $transaction ){

    $first_name = $transaction->details[0]->billing_info->first_name;
    $last_name = $transaction->details[0]->billing_info->last_name;
    $address = $transaction->details[0]->billing_info->address1;
    $city = $transaction->details[0]->billing_info->city;
    $zip = $transaction->details[0]->billing_info->zip;
    $transaction_uuid = $transaction->uuid;
    $created_date = $transaction->created_at->format('Ymd');
    $subscription_uuid = $transaction->subscription->get()->uuid;

    var_dump($subscription_uuid);
}

} catch(Exception $e){
    var_dump($e);
} ?>

This should, according to the Recurly documentation (https://docs.recurly.com/api/transactions), return the first page with a list of 15 transactions. However when the script runs I get the entire list with every transaction.

I'm trying to create a page that contains 15 transactions with a button to go to the next page, is there anything I'm doing wrong or am I reading the documentation wrong?

0

There are 0 answers