UMDEVELOPER
UMDEVELOPER

Reputation: 89

redirect issue after wepay payment success in php

I have a problem to redirect after wepay payment success means how can I redirect after this wepay url

https://stage.wepay.com/status/checkout_complete/1233455

and this is my code

try { 
    $data['checkout']= $wepay->request('/checkout/create', array(
            'account_id' => $account_id, // ID of the account that you want the money to go to
            'amount' => 1, // dollar amount you want to charge the user
             'currency' => 'USD',
            'short_description' => "this is a test payment", // a short description of what the payment is for
            'type' => "goods", // the type of the payment - choose from GOODS SERVICE DONATION or PERSONAL              
        )
    );
    // print_r($data['checkout']);
} catch (WePayException $e) { // if the API call returns an error, get the error message for display later
    $data['error'] = $e->getMessage();
}

Upvotes: 1

Views: 312

Answers (2)

TheF1rstPancake
TheF1rstPancake

Reputation: 2378

You can see how to redirect a user after a checkout is complete in the documentation: https://developer.wepay.com/api/api-calls/checkout#create.

You need to use the hosted_checkout structure. This only works if you are using the WePay iFrame or Hosted page for processing payments.

$data['checkout']= $wepay->request('/checkout/create', array(
        'account_id' => $account_id,
        'amount' => 1,
        'currency' => 'USD',
        'short_description' => "this is a test payment",
        'type' => "goods", 
        'hosted_checkout' => array( // hosted checkout structure
           'redirect_uri' => "http://google.com" // the url for redirect
        )    
    )
);

Upvotes: 1

Umair Khan
Umair Khan

Reputation: 1752

Try Using

$data['checkout']= $wepay->request('/checkout/create', array(
        'account_id' => $account_id, // ID of the account that you want the money to go to
        'amount' => 1, // dollar amount you want to charge the user
         'currency' => 'USD',
        'short_description' => "this is a test payment", // a short description of what the payment is for
        'type' => "goods", // the type of the payment - choose from GOODS SERVICE DONATION or PERSONAL
        'redirect_uri' => "http://google.com", // the url for redirect


    )
);

Upvotes: 0

Related Questions