x

Payment gateway unable to process successfull.

Hi,

 

My project name: https://cbd-5.com/

We have developed this project PHP (5.6 version), Codeigniter framework.

 

I followed all steps with payment transaction but i am unable to process successful payment.

when my payment successfully is done then I want to create order.

 

Please give me advice on how to integrate.

Awaiting your reply.

668 Views
Message 1 of 4
Report
3 REPLIES 3
Admin

Hey @sunil,

 

Thanks for reaching out!

 

It sounds like you may need help developing with Square APIs?

 

While we're not able to assist with APIs and web development via our Seller Community forum, your best ports of call here are our developer forums! You can also find additional development support resources and API guides via our Developer Documentation.

 

All the best!

 

Seamus
Square, Australia
Sign in and click Mark as Best Answer if my reply answers your question.
656 Views
Message 2 of 4
Report

I saw that youtube and other links also but i am intigrated php code

I am facing issue on server side please give me solution.

 

<?php
require 'connect-php-sdk-master/vendor/autoload.php';
$accessToken = "EAAAENmrs1x5ivhncYMG5I35gk-EIdfkP_QVitdv-CWcUI1JINCLEc25CXNsE5nl";
$locationId = "MAX8V7RGNJWGS";
// Create a new Charge request object
$chargeBody = new \SquareConnect\ChargeRequest() ;
// Create an Address object with shipping info
$shippingAddress = new \SquareConnect\Address() ;
$shippingAddress->setAddressLine1("123 Main St");
$shippingAddress->setLocality("San Francisco");
$shippingAddress->setAdministrativeDistrictLevel1("CA");
$shippingAddress->setPostalCode("94114");
$shippingAddress->setCountry("US");
// Create an Address object with billing info
$billingAddress = new \SquareConnect\Address() ;
$billingAddress->setAddressLine1("1500 Electric Ave");
$billingAddress->setAddressLine2("Suite 600");
$billingAddress->setLocality("New York City");
$billingAddress->setAdministrativeDistrictLevel1("NY");
$billingAddress->setPostalCode("20003");
$billingAddress->setCountry("US");
// Set the customer info
$chargeBody->setBuyerEmailAddress("thebuyer@example.com");
$chargeBody->setShippingAddress($shippingAddress);
$chargeBody->setBillingAddress($billingAddress);

$cardNonce = "fake-card-nonce-ok";
$idempotencyKey = uniqid();

// Set the charge amount to 10 USD
$chargeAmount = new \SquareConnect\Money() ;
$chargeAmount->setAmount(1000);
$chargeAmount->setCurrency("USD");

// Set the payment information
$chargeBody->setIdempotencyKey($idempotencyKey);
$chargeBody->setCardNonce($cardNonce);
$chargeBody->setAmount($chargeAmount);

$chargeBody->setReferenceId("Confirmation #12345");
$chargeBody->setNote("This is (not) a helpful note!");

// Create and configure a new API client object
$defaultApiConfig = new \SquareConnect\Configuration();
$defaultApiConfig->setAccessToken($accessToken);
$defaultApiClient = new \SquareConnect\ApiClient($defaultApiConfig);
$transactionsApi = new \SquareConnect\Api\TransactionsApi($defaultApiClient);
try {
$apiResponse = $transactionsApi->charge($locationId, $chargeBody);
// For now, just print the result to the screen
echo "<pre>" . print_r($apiResponse, true) . "</pre>";
} catch (\SquareConnect\ApiException $e) {
echo "<hr>" .
"The SquareConnect\Api\TransactionsApi object threw an exception.<br>" .
"API call: <code>TransactionsApi->charge</code>" .
"<pre>" . var_dump($e) . "</pre>";
throw $e;
}
?>

650 Views
Message 3 of 4
Report
Admin

Hey @sunil,

 

As per my previous post we're unfortunately not able to help troubleshoot API issues - feel free to post at the above linked developer forum if you'd like further assistance with this 🙂

Seamus
Square, Australia
Sign in and click Mark as Best Answer if my reply answers your question.
631 Views
Message 4 of 4
Report