For merchant ID, public key and private key you can have a look at below link:
http://pritomkumar.blogspot.com/2017/07/braintree-create-payment-token-store.html
Below is full example given:
Response from BrainTree Payment Gateway:
http://pritomkumar.blogspot.com/2017/07/braintree-create-payment-token-store.html
Below is full example given:
<?phprequire_once "CurlExecutor.php"; require_once "BrainTreeUtils.php";define("MERCHANT_ID", "k9y......xj6"); define("PUBLIC_KEY", "85....hh7"); define("PRIVATE_KEY", "510d5......................a00"); $array = array( "transaction" => array( 'amount' => "1.00", 'orderId' => htmlentities("REFUND_ID_" . time()) ) ); $base = "/transactions/6wex6xr6/refund"; $test = "https://api.sandbox.braintreegateway.com:443/merchants/" . MERCHANT_ID . $base; $live = "https://api.braintreegateway.com:443/merchants/" . MERCHANT_ID . $base; $headers[] = "Accept: application/xml"; $headers[] = "Content-Type: application/xml"; $headers[] = "X-ApiVersion: 4"; $closure = function(&$curl) { curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, PUBLIC_KEY . ':' . PRIVATE_KEY); }; $result = CurlExecutor::execute( $test, "POST", BrainTreeUtils::arrayToXml($array), null, $headers, $closure ); CurlExecutor::prettyPrint(BrainTreeUtils::arrayFromXml($result["response"]));
Response from BrainTree Payment Gateway:
Array ( [transaction] => Array ( [id] => ka3reng4 [status] => submitted_for_settlement [type] => credit [currencyIsoCode] => USD [amount] => 1.00 [merchantAccountId] => fj3...........z2 [subMerchantAccountId] => [masterMerchantAccountId] => [orderId] => REFUND_ID_1500098068 [createdAt] => DateTime Object ( [date] => 2017-07-15 05:54:24.000000 [timezone_type] => 3 [timezone] => UTC ) [updatedAt] => DateTime Object ( [date] => 2017-07-15 05:54:24.000000 [timezone_type] => 3 [timezone] => UTC ) [customer] => Array ( [id] => 608968099 [firstName] => Pritom [lastName] => Kumar [company] => My Company [email] => pritomkucse@gmail.com [website] => [phone] => 33303030 [fax] => ) [billing] => Array ( [id] => vt [firstName] => Pritom [lastName] => Kumar [company] => [streetAddress] => [extendedAddress] => [locality] => [region] => [postalCode] => [countryName] => [countryCodeAlpha2] => [countryCodeAlpha3] => [countryCodeNumeric] => ) [refundId] => [refundIds] => Array ( ) [refundedTransactionId] => 6wex6xr6 [partialSettlementTransactionIds] => Array ( ) [authorizedTransactionId] => [settlementBatchId] => [shipping] => Array ( [id] => [firstName] => [lastName] => [company] => [streetAddress] => [extendedAddress] => [locality] => [region] => [postalCode] => [countryName] => [countryCodeAlpha2] => [countryCodeAlpha3] => [countryCodeNumeric] => ) [customFields] => [avsErrorResponseCode] => [avsPostalCodeResponseCode] => A [avsStreetAddressResponseCode] => A [cvvResponseCode] => A [gatewayRejectionReason] => [processorAuthorizationCode] => [processorResponseCode] => 1002 [processorResponseText] => Processed [additionalProcessorResponse] => [voiceReferralNumber] => [purchaseOrderNumber] => [taxAmount] => [taxExempt] => [creditCard] => Array ( [token] => 6m76wy [bin] => 444433 [last4] => 1111 [cardType] => Visa [expirationMonth] => 12 [expirationYear] => 2018 [customerLocation] => US [cardholderName] => Test [imageUrl] => https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox [prepaid] => Unknown [healthcare] => Unknown [debit] => Unknown [durbinRegulated] => Unknown [commercial] => Unknown [payroll] => Unknown [issuingBank] => Unknown [countryOfIssuance] => Unknown [productId] => Unknown [uniqueNumberIdentifier] => 8a0a2661613868d36fbfde247bfaf06f [venmoSdk] => ) [statusHistory] => Array ( [0] => Array ( [timestamp] => DateTime Object ( [date] => 2017-07-15 05:54:24.000000 [timezone_type] => 3 [timezone] => UTC ) [status] => submitted_for_settlement [amount] => 1.00 [user] => j234lk2342342j3l4 [transactionSource] => api ) ) [planId] => [subscriptionId] => [subscription] => Array ( [billingPeriodEndDate] => [billingPeriodStartDate] => ) [addOns] => Array ( ) [discounts] => Array ( ) [descriptor] => Array ( [name] => [phone] => [url] => ) [recurring] => [channel] => [serviceFeeAmount] => [escrowStatus] => [disbursementDetails] => Array ( [disbursementDate] => [settlementAmount] => [settlementCurrencyIsoCode] => [settlementCurrencyExchangeRate] => [fundsHeld] => [success] => ) [disputes] => Array ( ) [authorizationAdjustments] => Array ( ) [paymentInstrumentType] => credit_card [processorSettlementResponseCode] => [processorSettlementResponseText] => [threeDSecureInfo] => ) )
No comments:
Post a Comment