Paypal adaptive payments parallel payments status of each transaction - php

I mainly recieve two different status from Paypal for Adaptive payments parallel payment as COMPLETE and INCOMPLETE. Problematic one is INCOMPLETE. Here is a sample from $_POST dump:
array (
'transaction' =>
array (
7 => 'Completed',
6 => 'false',
8 => 'INV-MY612341Z44L',
0 => 'USD 11.11',
5 => 'Completed',
3 => 'Completed',
1 => 'Completed',
9 => 'USD 10.01',
2 => '8J716621241U839814X',
4 => 'Completed',
),
'reverse_all_parallel_payments_on_error' => 'false',
'ipn_notification_url' => 'myurl',
'verify_sign' => 'An5n123s1Ksasd2wsqso7MWU-AILx45idIbbLL8PRFiTJ',
'charset' => 'windows-1254',
'payment_request_date' => 'Fri Mar 27 09:07:29 PDT 2015',
'sender_email' => 'paypal#mydomain.com',
'status' => 'INCOMPLETE',
I understand, if status of parallel payment is COMPLETE, i can safely mark all as complete, when it is incomplete, i have hard time to parse it since there is not much difference between each transaction_id responses of COMPLETE and INCOMPLETE.
How do i get neat response for transaction[n].status_for _sender_txn as taken from https://developer.paypal.com/docs/classic/adaptive-payments/integration-guide/APIPN/
The transaction status, where [n] is a number from 0 to 5. For simple single-receiver payments, this number will be 0. Numbers larger than 0 indicate the payment to a particular receiver in chained and parallel payments. Possible values are:
COMPLETED – The sender's transaction has completed
PENDING – The transaction is awaiting further processing
CREATED – The payment request was received; ...
PARTIALLY_REFUNDED– Transaction was partially refunded
DENIED – The transaction was rejected by the receiver
PROCESSING – The transaction is in progress
REVERSED – The payment was returned to the sender
REFUNDED – The payment was refunded
FAILED – The payment failed

Related

how to get refunded transactions details using payflow pro api php

I have integrated Payflow pro payment gateway into my php application and processing payment requests using Payflow as payment gateway.
I need to retrieve transaction history which includes refunds too for specific profile ID.
Below is the code that I am using: ref - (https://github.com/rcastera/Paypal-PayFlow-API-Wrapper-Class).
require_once(__DIR__.'/Class.PayFlow.php');
$PayFlowAuth = new PayFlow($Vendor, $Partner, $User, $Password, 'single');
$PayFlowAuth->setTransactionType('R');
$PayFlowAuth->setProfileAction('I');
$PayFlowAuth->setCustomField('ORIGPROFILEID', 'RP0000000XYZ' );
$PayFlowAuth->setCustomField('PAYMENTHISTORY', 'Y' );
$PayFlowAuth->setEnvironment('live');
$PayFlowAuth->processTransaction();
$response = $PayFlowAuth->getResponse();
echo '<pre>';
print_r($response);
I get below response:
Array
(
[RESULT] => 0
[RPREF] => RHX51F5D3XYZ
[PROFILEID] => RP0000000XYZ
[P_PNREF1] => BK0P6E1C2XYZ
[P_TRANSTIME1] => 19-Jun-19 04:42 AM
[P_RESULT1] => 0
[P_TENDER1] => C
[P_AMT1] => 30.00
[P_TRANSTATE1] => 8
[P_PNREF2] => BK0P6EB8DXYZ
[P_TRANSTIME2] => 21-Jul-19 04:44 AM
[P_RESULT2] => 12
[P_TENDER2] => C
[P_AMT2] => 30.00
[P_TRANSTATE2] => 1
[P_PNREF3] => BR0P6482FXYZ
[P_TRANSTIME3] => 19-Aug-19 04:52 AM
[P_RESULT3] => 0
[P_TENDER3] => C
[P_AMT3] => 30.00
[P_TRANSTATE3] => 8
)
However it does not include refunded transaction. When I search in paypal manager, I can see these 3 transactions along with 1 refund transaction too. I tried changing TRXTYPE to C (credit) but it gives the error: Invalid tender
So I am looking for any such parameter change where I can retrieve refunded transaction history or may be any method in payflow pro api.
At the end asked paypal support and they replied.
unfortunately, there is no API to get refunded transactions. I'll
contact our engineers for possible feature request. I apologize for
the inconvenience.
That is correct. Credits are issued outside of the profile so they are not tied to it and as a result do not show up when doing a PAYMENTHISTORY call.

Kraken API <-> PHP withdrawl issue

I need help with the kraken API. I have created the connection and I am able to trade various pairs but now I need to make an automatic withdraw using their API. For the trading pairs I have the following running which buys 0.002 BTC using EURO
$res = $kraken->QueryPrivate('AddOrder', array(
'pair' => 'XBTEUR',
'type' => 'sell',
'ordertype' => 'market',
'volume' => '0.002',
));
print_r($res);
Now... how do I withdraw 0.002 btc using the api and sending these to my wallet: 1BujYrWGkzFdmecXUNgj8nE13gwXtxZxKZ
I can't seem to find this specific information anywhere :(
To answer my own question, this was the code I needed:
$res = $kraken->QueryPrivate('Withdraw', array(
'asset' => 'XBT',
'key' => 'withdrawal key name here',
'amount' => '0.002',
));
print_r($res);
Where as the key, was the name of the account which contained the wallet I wanted to withdraw fund to.

php parallel payment - transaction fee

How can i achieve this below scenario? taken fron payPal site.
Receiver Pays the Fee in a Parallel Payment
If the receivers pay the fee in a parallel payment, each receiver pays a portion of the fee, based on their assessment. The following example shows the receivers paying the fees:
My paremeters:
$bodyParams = array (
"actionType" => "PAY",
"currencyCode" => "USD",
"receiverList.receiver(0).email" => $receiver_p,
"receiverList.receiver(0).amount" => $amount_primary,
//"receiverList.receiver(0).primary"=>true,
"receiverList.receiver(1).email" => $receiver["paypal_id"][0],
"receiverList.receiver(1).amount" => $amount[0],
"receiverList.receiver(2).email" => $receiver["paypal_id"][1],
"receiverList.receiver(2).amount" => $amount[1],
"receiverList.receiver(3).email" => $receiver["paypal_id"][2],
"receiverList.receiver(3).amount" => $amount[2],
"receiverList.receiver(4).email" => $receiver["paypal_id"][3],
"receiverList.receiver(4).amount" => $amount[3],
"returnUrl" => APP_WEB_ROOT.'/checkout.php?cmd=paid',
"cancelUrl" => APP_WEB_ROOT.'/checkout.php',
"requestEnvelope.errorLanguage" => "en_US",
'FeesPayer' => 'EACHRECEIVER'
);
is 'FeesPayer' => 'EACHRECEIVER' is enough parameter to pass to achive the above scenario. how can i check this in sandbox?
Yes, EACHRECEIVER is what you want. You can test this in the sandbox by creating multiple sandbox accounts and then setting up a payment that gets split among those receivers. When you complete that checkout in the sandbox you could then login to each receiver account and see the fee they paid.

Braintree marketplace - What happens if Master Merchant do charge client at time time of sale, but has to pay to submerchant

I have implemented PHP braintree API in a project, I want to use Marketplace api for the same.
Now, we have promotional events and we do not charge client, but we have to pay amount to sub-merchant who has delivered goods.
So below is the code to add service fees, which is clear that at the time of sale we have to add sub-merchant id for merchantAccountId, amount will be payment charged from client, what is paymentMethodNonce?
$result = Braintree_Transaction::sale(array(
'merchantAccountId' => 'provider_sub_merchant_account',
'amount' => '10.00',
'paymentMethodNonce' => 'nonce-from-the-client',
'serviceFeeAmount' => "1.00"
));
Another query is, at the time of sale we have to pass credit card details of the client? What if client is already in vault ?
Below is another code from Braintree document with creditCard details
$result = Braintree_Transaction::sale(
array(
'amount' => "100",
'merchantAccountId' => "blue_ladders_store",
'creditCard' => array(
'number' => "4111111111111111",
'expirationDate' => "12/20",
),
'options' => array(
'submitForSettlement' => true,
'holdInEscrow' => true,
),
'serviceFeeAmount' => "10.00"
)
);
If we do not add creditCard number and have to pay sub-merchant then how can that be done.
Thanks

Authorize.net AIM refund transaction error 3.2.33

According to authorize.net pdf instructions I use the AIM parameters:
"x_login" => $AimLoginID,
"x_tran_key" => $AimTransKey,
"x_version" => "3.1",
"x_delim_data" => "TRUE",
"x_delim_char" => "|",
"x_relay_response" => "FALSE",
"x_type" => $Type,
"x_trans_id" => $TransID,
"x_amount" => $Amount,
"x_card_num" => $CCLast4,
"x_invoice_num" => $invoicenumber
where
x_tran_key is the original transaction ID as given to my from authorize.net
type = CREDIT as I want to refund
x_amount equals the exact amount I previously charged on the credit card
x_card_num is filled with the last 4 digits from the credit card.
x_invoice_num has my invoice number
the message I get back gives me an error.
Array
(
[0] => 3
[1] => 2
[2] => 33
[3] => Recurring Billing is required.
this does not make any sense as it is not a recurring billing?
at the beginning I tried it without the invoice number, but the retunred errorcode informed me that I need to give them also that. I also tried to give the parameter x_exp_date as '' (i saw a suggestion for this online) but it didn't work, had the same message.
Any idea or suggestion will be highly appreciated.
Please, check x_recurring_billing - perhaps it is enabled as "required".
You need to access your Merchant Interface. Check if this field is set as Required.
Just change the FIELD value to NOT REQUIRED.
See more detailed problem explaination here http://community.developer.authorize.net/t5/Integration-and-Testing/Receiving-Response-3-2-33-Recurring-Billing-is-required/td-p/718

Categories