Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I redirect user to my website page after paying? #17

Closed
Haruteghiazaryan1987 opened this issue Mar 22, 2022 · 2 comments
Closed
Labels
question Further information is requested

Comments

@Haruteghiazaryan1987
Copy link

Haruteghiazaryan1987 commented Mar 22, 2022

No description provided.

@jeybin
Copy link
Contributor

jeybin commented Sep 19, 2022

Give the url as parameter while creating charge, you can pass

  • Redirect URL (redirect_url) :
    Once the payment is succeed coinbase will redirect to the redirect_url specified in the create charge request

  • Cancel URL (cancel_url)
    Once the payment is cancelled coinbase will redirect to the cancel_url specified in the create charge request

$newRequest['name'] = $payment_name;
$newRequest['description'] = $payment_description;
$newRequest['pricing_type'] = 'fixed_price';
$newRequest['metadata'] = [
    'customer_id' => $customer_email,
    'customer_name' => $customer_name
];
$newRequest['local_price'] = ['currency' => $currency, 'amount' => $amount];
$newRequest['redirect_url'] = 'https//example.com/payment-success';
$newRequest['cancel_url'] = 'https//example.com/payment-cancelled';

Coinbase::createCharge($newRequest);

The request will be as below

{
    "name": "Payment name",
    "description": "payment description",
    "pricing_type": "fixed_price",
    "metadata": {
        "customer_id": "customer_id",
        "customer_name": "customer_name"
    },
    "local_price": {
        "currency": "USD",
        "amount": 1000
    },
    "redirect_url": "https//example.com/payment-success",
    "cancel_url": "https//example.com/payment-cancelled"
}

@antimech
Copy link
Collaborator

antimech commented Jul 8, 2023

https://docs.cloud.coinbase.com/commerce/reference/createcharge

$charge = Coinbase::createCharge([
    'name' => 'Name',
    'description' => 'Description',
    'local_price' => [
        'amount' => 100,
        'currency' => 'USD',
    ],
    'pricing_type' => 'fixed_price',
    'redirect_url' => 'https//example.com/payment-success',
]);

@antimech antimech closed this as completed Jul 8, 2023
@antimech antimech added the question Further information is requested label Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants