Create a charge using php api complete source code

Create a charge using php api complete source code send me on my whatsapp 9631870667

Hello @allsupport! Welcome to the forum! You’ve mentioned that you want the complete PHP source code for creating a Charge. For this, we would like to introduce you to the Coinbase Commerce API. Using this API, you can create a charge object in order to get paid in cryptocurrency. You’ll just have to provide the user with a cryptocurrency address to which they must send the cryptocurrency. Also, we moved the category of your forum post from Exchange/Pro API to Commerce API.

Regarding your concern of creating a Charge using PHP, you may browse this documentation and go through the sample request. You can select different programming languages including PHP. You may also refer to the sample request below in PHP.

<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.commerce.coinbase.com/charges', [
  'body' => '{"local_price":{"amount":1,"currency":"BTC"},"metadata":{"customer_id":"customer1","customer_name":"Person1"},"name":"Example1","description":"Create Charge using PHP","pricing_type":"fixed_price","redirect_url":"https://charge/completed/page","cancel_url":"https://charge/canceled/page"}',
  'headers' => [
    'X-CC-Version' => '2018-03-22',
    'accept' => 'application/json',
    'content-type' => 'application/json',
  ],
]);

echo $response->getBody();

Additionally, we are only to provide support inside the Coinbase dev forum platform and we cannot assist you further on sending the code to your personal whatsapp or any social application. We appreciate your understanding on this matter.

Thank you and again welcome to the community!

3 Likes

But where button to click to pay plz send complete source code on my whatsapp 9631870667

Hi @allsupport!

You may refer here on how to add a payment button.

For sending a code to your whatsapp, we apologize but as we mentioned in our last response we only provide support inside the Coinbase dev forum platform and cannot assist on sending a code to any social application including whatsapp.

Thank you for understanding. We hope this helps.

3 Likes

But i want payment gateway system

Actually I have a website so I want to add in this recharge system, actually I want that after user paid then callback in a url where I add point in his user wallet