Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/./../app/.././../../finland.picotech.app/public_html/storage/../vendor/./nikic/../dompdf/../alexandr-mironov/../monolog/../unicodeveloper/../dragonmantank/../telnyx/../filp/../phpstan/.././laminas/../africastalking/./../laravel/../././myclabs/../coinpaymentsnet/coinpayments-php/examples
الملفات الموجودة في هذا الـ Path:
.
..
accepted_currencies.php
conversion_limits.php
convert_coins.php
create_complex_transaction.php
create_merchant_transfer.php
create_simple_transaction.php
fiat_to_coin_prices.php
get_basic_information.php
get_coin_balances.php
mass_withdrawal.php
update_pbn_profile.php
withdrawal_history.php

مشاهدة ملف: create_simple_transaction.php

<?php
require('../src/Coinpayments.php');
require('../src/keys.php');

/** Scenario: Create a simple transaction. **/

// Create a new API wrapper instance
$cps_api = new CoinpaymentsAPI($private_key, $public_key, 'json');

// Enter amount for the transaction
$amount = 0.005;

// Litecoin Testnet is a no value currency for testing
$currency = 'LTCT';

// Enter buyer email below
$buyer_email = '';

// Make call to API to create the transaction
try {
    $transaction_response = $cps_api->CreateSimpleTransaction($amount, $currency, $buyer_email);
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
    exit();
}

if ($transaction_response['error'] == 'ok') {
    // Success!
    $output = 'Transaction created with ID: ' . $transaction_response['result']['txn_id'] . '<br>';
    $output .= 'Amount for buyer to send: ' . $transaction_response['result']['amount'] . '<br>';
    $output .= 'Address for buyer to send to: ' . $transaction_response['result']['address'] . '<br>';
    $output .= 'Seller can view status here: ' . $transaction_response['result']['status_url'];

} else {
    // Something went wrong!
    $output = 'Error: ' . $transaction_response['error'];
}

// Output the response of the API call
echo $output;