I'm developing website, where user will have some paid content. In this case I'm using PayPal subscription. I successfully made subscription and want to get subscription expiration date. I'm using GetRecurringPaymentsProfileDetails method to get information about subscription. Here is result of this method:
`array (size=45)
'PROFILEID' => string 'I-DLUN4G0R3G0F' (length=14)
'STATUS' => string 'Active' (length=6)
'AUTOBILLOUTAMT' => string 'NoAutoBill' (length=10)
'DESC' => string 'Monthly subscription' (length=20)
'MAXFAILEDPAYMENTS' => string '3' (length=1)
'SUBSCRIBERNAME' => string 'blah-blah-blah' (length=14)
'PROFILESTARTDATE' => string '2015-09-08T07:00:00Z' (length=20)
'NEXTBILLINGDATE' => string '2015-09-08T10:00:00Z' (length=20)
'NUMCYCLESCOMPLETED' => string '0' (length=1)
'NUMCYCLESREMAINING' => string '0' (length=1)
'OUTSTANDINGBALANCE' => string '0.00' (length=4)
'FAILEDPAYMENTCOUNT' => string '0' (length=1)
'TRIALAMTPAID' => string '0.00' (length=4)
'REGULARAMTPAID' => string '0.00' (length=4)
'AGGREGATEAMT' => string '0.00' (length=4)
'AGGREGATEOPTIONALAMT' => string '0.00' (length=4)
'FINALPAYMENTDUEDATE' => string '1970-01-01T00:00:00Z' (length=20)
'TIMESTAMP' => string '2015-09-08T10:55:59Z' (length=20)
'CORRELATIONID' => string 'fb5da7dc8451f' (length=13)
'ACK' => string 'Success' (length=7)
'VERSION' => string '86.0' (length=4)
'BUILD' => string '17972692' (length=8)
'BILLINGPERIOD' => string 'Month' (length=5)
'BILLINGFREQUENCY' => string '1' (length=1)
'TOTALBILLINGCYCLES' => string '0' (length=1)
'CURRENCYCODE' => string 'GBP' (length=3)
'AMT' => string '9.99' (length=4)
'SHIPPINGAMT' => string '0.00' (length=4)
'TAXAMT' => string '0.00' (length=4)
'REGULARBILLINGPERIOD' => string 'Month' (length=5)
'REGULARBILLINGFREQUENCY' => string '1' (length=1)
'REGULARTOTALBILLINGCYCLES' => string '0' (length=1)
'REGULARCURRENCYCODE' => string 'GBP' (length=3)
'REGULARAMT' => string '9.99' (length=4)
'REGULARSHIPPINGAMT' => string '0.00' (length=4)
'REGULARTAXAMT' => string '0.00' (length=4)
`
As you can see above, I have NEXTBILLINGDATE field, and I thought that it's what I needed. The problem is that this field shows incorrect time. Seems like NEXTBILLIGDATE should be something like 2015-10-08T07:00:00Z according to my REGULARBILLINGPERIOD and REGULARBILLINGFREQUENCY fields. Also, maybe someone know how to test expired subscription? Or how to make expired subscription, is there any tools in PayPal sandbox?. Hope to find solution here. Thanks
The first charge happens within 24 hours after the profile created according to the doc, so if you call GetRecurringPaymentsProfileDetails before the first charge(for example right after the create call success) the NEXTBILLINGDATE will still be the start date.
There's no tool or API to make expired subscription in sandbox, you can create a daily subscription and set TOTALBILLINGCYCLES=1, and the next day it will just expire..
Related
I'm having some problems with Paypal express in magento 2, I've migrated from magento 1, and now all is working, expect for paypal express.
I've debug paypal express and I get what I will post, for what I see the problem is maybe because o the prodcut prices are with tax included.
I've already acomplished to have the price without tax in checkout, but he always get the price with tax, what can I do? I've already disabled "Transfer cart line items".
The log is:
'AMT' => '16.70',
'CURRENCYCODE' => 'EUR',
'INVNUM' => '1000012787',
'SHIPPINGAMT' => '3.75',
'ITEMAMT' => '12.95',
'TAXAMT' => '2.42',
'BUSINESS' => 'rtr',
'NOTETEXT' => NULL,
'EMAIL' => 'info#test.pt',
'FIRSTNAME' => 'ertr',
'LASTNAME' => 'trt',
'MIDDLENAME' => NULL,
'SALUTATION' => NULL,
'SUFFIX' => NULL,
'COUNTRYCODE' => 'PT',
'STATE' => 'PR',
'CITY' => 'rt',
'STREET' => 'tr',
'ZIP' => '2335',
'PHONENUM' => 'rtrtrt',
'SHIPTOCOUNTRYCODE' => 'PT',
'SHIPTOSTATE' => 'PR',
'SHIPTOCITY' => 'rt',
'SHIPTOSTREET' => 'tr',
'SHIPTOZIP' => '2335',
'SHIPTOPHONENUM' => 'rtrtrt',
'SHIPTOSTREET2' => 'trt',
'STREET2' => 'trt',
'SHIPTONAME' => 'ertr trt',
'ADDROVERRIDE' => 1,
'METHOD' => 'SetExpressCheckout',
'VERSION' => '72.0',
'USER' => '****',
'PWD' => '****',
'SIGNATURE' => '****',
'BUTTONSOURCE' => 'Magento_Cart_Community',
'TIMESTAMP' => '2019-09-03T11:20:28Z',
'CORRELATIONID' => '403c3d4df0570',
'ACK' => 'Failure',
'VERSION' => '72.0',
'BUILD' => '53481737',
'L_ERRORCODE0' => '10413',
'L_SHORTMESSAGE0' => 'Transaction refused because of an invalid argument. See additional error messages for details.',
'L_LONGMESSAGE0' => 'The totals of the cart item amounts do not match order amounts.',
'L_SEVERITYCODE0' => 'Error',
Can anyone help me?
Best regards,
Leonel Nunes
When calling GetExpressCheckoutDetails the SHIPTONAME and EMAIL fields are missing from the response. I know that SHIPTONAME is deprecated, but the replacement field is missing as well. Full response below.
I can adjust for the missing name, but need the email for customer communications.
What would cause these fields to be missing from the response?
array(
'TOKEN' => 'XXXXXX',
'BILLINGAGREEMENTACCEPTEDSTATUS' => '0',
'CHECKOUTSTATUS' => 'PaymentActionCompleted',
'TIMESTAMP' => '2015-08-12T16:36:24Z',
'CORRELATIONID' => 'XXXXXX',
'ACK' => 'Success',
'VERSION' => '113',
'BUILD' => '000000',
'PAYERID' => 'XXXXXXXX',
'PAYERSTATUS' => 'verified',
'COUNTRYCODE' => 'US',
'SHIPTOSTREET' => 'XXXXXX',
'SHIPTOCITY' => 'XXXXXX',
'SHIPTOSTATE' => 'XX',
'SHIPTOZIP' => 'XXXXX',
'SHIPTOCOUNTRYCODE' => 'US',
'SHIPTOCOUNTRYNAME' => 'United States',
'ADDRESSSTATUS' => 'Confirmed',
'CURRENCYCODE' => 'USD',
'AMT' => '27.90',
'SHIPPINGAMT' => '0.00',
'HANDLINGAMT' => '0.00',
'TAXAMT' => '0.00',
'NOTIFYURL' => 'https://xxxxx.xxx/xxx',
'INSURANCEAMT' => '0.00',
'SHIPDISCAMT' => '0.00',
'TRANSACTIONID' => 'XXXXXX',
'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
'PAYMENTREQUEST_0_AMT' => '27.90',
'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
'PAYMENTREQUEST_0_HANDLINGAMT' => '0.00',
'PAYMENTREQUEST_0_TAXAMT' => '0.00',
'PAYMENTREQUEST_0_NOTIFYURL' => 'https://xxxxx.xxx/xxx',
'PAYMENTREQUEST_0_INSURANCEAMT' => '0.00',
'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
'PAYMENTREQUEST_0_TRANSACTIONID' => 'XXXXXX',
'PAYMENTREQUEST_0_SHIPTOSTREET' => 'XXXXXX',
'PAYMENTREQUEST_0_SHIPTOCITY' => 'XXXXXX',
'PAYMENTREQUEST_0_SHIPTOSTATE' => 'XX',
'PAYMENTREQUEST_0_SHIPTOZIP' => 'XXXXX',
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'US',
'PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME' => 'United States',
'PAYMENTREQUEST_0_ADDRESSSTATUS' => 'Confirmed',
'PAYMENTREQUESTINFO_0_TRANSACTIONID' => 'XXXXX',
'PAYMENTREQUESTINFO_0_ERRORCODE' => '0'
)
There is an issue open with PayPal regarding this and they have acknowledged it as a bug. We suffer the same problems, once in a while the PayerId and any personal detail fields (email address etc) are omitted.
You need to take the correlation ID field that they would have returned to you from the faulty API call and ask them to investigate / open a ticket. That's the only way to get them to respond positively.
Saying that, this has been going on a while now and it is still not solved. But at least you know it's not just you.
The PayPal IPN serves the following data:
'mc_gross' => '715.80',
'protection_eligibility' => 'Eligible',
'address_status' => 'unconfirmed',
'item_number1' => '',
'payer_id' => 'UCTG7GEULVxxx',
'tax' => '0.00',
'address_street' => 'Pl 2270',
'payment_date' => '00:35:08 Jul 31, 2014 PDT',
'payment_status' => 'Completed',
'charset' => 'windows-1252',
'address_zip' => '26492',
'mc_shipping' => '0.00',
'mc_handling' => '0.00',
'first_name' => 'Benny',
'mc_fee' => '8.94',
'address_country_code' => 'SE',
'address_name' => 'Benny Andersxxx',
'notify_version' => '3.8',
'custom' => '',
'payer_status' => 'verified',
'business' => 'paypal#xxx.com',
'address_country' => 'Sweden',
'num_cart_items' => '1',
'mc_handling1' => '0.00',
'address_city' => 'Klippan',
'verify_sign' => 'AiJvJDl-VyZzRT4Hq0qB1wSjgCgGAvdLxvQHk79AHsO0AjdeWvSwxxx',
'payer_email' => 'benny.anderxxx#xxx.com',
'mc_shipping1' => '0.00',
'tax1' => '0.00',
'txn_id' => '1M112630L55146xxx',
'payment_type' => 'instant',
'last_name' => 'Andersxxx',
'address_state' => '_0_',
'item_name1' => 'Order xxx.com 2014-07-31',
'receiver_email' => 'paypal#xxx.com',
'payment_fee' => '',
'quantity1' => '1',
'receiver_id' => '4AMCEP9BMPxxx',
'txn_type' => 'cart',
'mc_gross_1' => '715.80',
'mc_currency' => 'EUR',
'residence_country' => 'SE',
'transaction_subject' => '',
'payment_gross' => '',
'ipn_track_id' => '354021aeaxxx',
Is it possible getting through the information above to the transaction id which is required in quite a lot of other API transactions?
Actually, I'm trying to execute a refund via this call:
https://api.paypal.com/v1/payments/sale/{transactionId}/refund
However, I'm still missing the correct ID here and meanwhile I don't have any more ideas how to collect this transaction id (I guess it should look like ""PAY-PT597110X687430LKGECATA") ....
Please keep in mind that I'm using the REST API and not the classic API.
Edit: I don't know why, but every time I edit this article and add a "Hello" at the beginning, it is being deleted after saving :-( Sorry!
The transaction id is found on this line
'txn_id' => '1M112630L55146xxx',
You would need to call this URL with REST (sandbox URL shown, adjust for Live as needed)
https://api.sandbox.paypal.com/v1/payments/refund/1M112630L55146xxx
You can see more details in the API reference
Just got a message from PayPal that refunds are only partially available wioth REST API. I'll now try it with Classic API...
However, it didn't work with the txn_id # Machavity
I'm having a currency problem with Paypal Sandbox.
I'm testing recurring payments for my site using the sandbox
(digital goods, express checkout)
Everything is working as expected.
The user clicks on pay.
The user is transfered to paypal express checkout login.
The paypal login screen shows the correct amount in the correct currency e.g. £10
The user logs in (authenticates the transaction)
The payment is successful and the user returns to our site.
Lovely. It all works as I would expect.
However, when I log into the merchant sandbox account to check the activity, all of the £xx payments my test user made are now in $xx (USD)
How can I fix this, or does Sandbox only support USD and this will go away if I go live?
I have tried changing the currency in my request (i.e. setting PAYMENTREQUEST_0_CURRENCYCODE = something else) - that changes the currency in the payment page login, but regardless, all payments still come through as USD in the merchant login.
I have GBP, Euro and USD setup as currencies in my merchant account.
A request looks like this (except all keys are converted to UC before sending the request to PayPal).
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
'paymentaction' => 'Sale',
'PAYMENTREQUEST_0_CURRENCYCODE' => 'GBP',
'l_billingtype0' => 'RecurringPayments',
'returnUrl' => 'http://site.com',
'brandname' => 'Name',
'L_PAYMENTREQUEST_0_DESC0' => 'GoPro 10',
'allownote' => 0,
'l_billingagreementdescription0' => 'goPro 10.',
'PAYMENTREQUEST_0_ITEMAMT' => '10.00',
'cancelUrl' => 'http://site.com/payment/cancel/7',
'PAYFLOWCOLOR' => '518daf',
'PAYMENTREQUEST_0_AMT' => '10.00',
'L_PAYMENTREQUEST_0_ITEMCATEGORY0' => 'Digital',
'HDRIMG' => 'http://site.com/images/logo230x95.png',
'MAXFAILEDPAYMENTS' => 0,
'L_PAYMENTREQUEST_0_NAME0' => '10',
'noshipping' => 1,
'L_PAYMENTREQUEST_0_NUMBER0' => 'CR7',
'L_PAYMENTREQUEST_0_QTY0' => 1,
The response form paypay is "Success", however if I perform a
GetRecurringPaymentsProfileDetails
Then the result from paypal is in USD. E.g.
'totalbillingcycles' => '0',
'trialamtpaid' => '0.00',
'autobilloutamt' => 'NoAutoBill',
'ack' => 'Success',
'desc' => 'Gift or use 110 points per month and receive 70% revenue share with goPro 10.',
'numcyclesremaining' => '0',
'amt' => '10.00',
'maxfailedpayments' => '0',
'nextbillingdate' => '2012-11-22T10:00:00Z',
'regularbillingperiod' => 'Day',
'aggregateamt' => '0.00',
'subscribername' => 'name',
'regulartotalbillingcycles' => '0',
'billingperiod' => 'Day',
'outstandingbalance' => '0.00',
'status' => 'Active',
'regularamtpaid' => '0.00',
'taxamt' => '0.00',
'regulartaxamt' => '0.00',
'failedpaymentcount' => '0',
'regularshippingamt' => '0.00',
'profileid' => 'I-616GDHNKDXKL',
'timestamp' => '2012-11-22T12:28:26Z',
'regularbillingfrequency' => '1',
'version' => '95.0',
'finalpaymentduedate' => '1970-01-01T00:00:00Z',
'build' => '4181146',
'numcyclescompleted' => '0',
'correlationid' => 'c3fc55a117agh',
'shippingamt' => '0.00',
'regularcurrencycode' => 'USD',
'regularamt' => '10.00',
'aggregateoptionalamt' => '0.00',
'profilestartdate' => '2012-11-22T00:00:00Z',
'billingfrequency' => '1',
'currencycode' => 'USD',
Is there something obvious I'm missing?
Ah, I asked too early, it seems that the field
PAYMENTREQUEST_0_CURRENCYCODE is ignored (I'm not sure why - it's documented)
You must use
CURRENCYCODE = GBP (which is documented as deprecated).
I'm trying to set a #default_value on my D7 form, but it's not working... This is my array:
'thema_30fdc789-1453-4efa-93d6-123cab52206e' =>
array
'#type' => string 'checkboxes' (length=10)
'#title' => string 'What kind of fiches??' (length=42)
'#options' =>
array
'create' => string 'New fiches' (length=13)
'update' => string 'Updated fiches' (length=13)
'delete' => string 'Deleted fiches' (length=13)
After editing this form with this line:
$form['thema_30fdc789-1453-4efa-93d6-123cab52206e']['#default_values']=
array('create' => 'Nieuwe fiches', 'update' => 'Update fiches', 'delete' => 'Delete fiches');
I get this var_dump:
'thema_30fdc789-1453-4efa-93d6-123cab52206e' =>
array
'#type' => string 'checkboxes' (length=10)
'#title' => string 'What kind of fiches??' (length=42)
'#options' =>
array
'create' => string 'Newfiches' (length=13)
'update' => string 'Updated fiches' (length=13)
'delete' => string 'Deleted fiches' (length=13)
'#default_values' =>
array
'create' => string 'Newfiches' (length=13)
'update' => string 'Updated fiches' (length=13)
'delete' => string 'Deleted fiches' (length=13)
So, the hook_form_alter did his job. Nevertheless, the checkboxes aren't checked on when reloading the page... What do I need to do to make sure they are checked on?
Nevermind. I found it myself. I needed to adjust the string to this:
$form['thema_30fdc789-1453-4efa-93d6-123cab52206e']['#default_value'] = array('create', 'update','delete');