buycred_get_pending_payment
Description
This function retrieves the buyCRED pending payment object based on a given pending payment ID.
This function is only available if the buyCRED add-on is enabled.
Available since version 1.7
Returns
(bool | object) Returns either the payment object or FALSE if the payment is not found.
Parameters
| Param | Type | Required | Description | |
|---|---|---|---|---|
function buycred_get_pending_payment( |
||||
$payment_id |
string | Yes | The buyCRED pending payment ID. |
|
) { ... } |
||||
Pending Payment Object Example
Std Object
(
[payment_id] => 1
[public_id] => 'ABC123'
[point_type] => 'mycred_default'
[amount] => 250
[cost] => 100
[currency] => 'USD'
[buyer_id] => 2
[recipient_id] => 2
[gateway_id] => 'paypal-standard'
[transaction_id] => ''
[cancel_url] => 'https://www.yourwebsite.com/cancelled/'
[pay_now_url] => 'https://www.yourwebsite.com/buy/?mycred_buy=paypal-standard&revisit=ABC123'
) Examples
Example 1: Basic usage example
$payment_id = sanitize_text_field( $_GET['id'] );
$pending_payment = buycred_get_pending_payment( $payment_id );
if ( $pending_payment !== false ) {
// Payment was found.
}