Hi I have been trying to validate CC no., CVV no., EXPDATE of the users credit card for recurring billing in PayFlow. The main objective is to let the user have access to subscription products only if the credit card is valid.
I have been advised to check the card prior to creating the profile you could run a credit card verification ($0 authorization)
So I did it and I got [RESPMSG] => Verified
Here's my request and response messages:
Request
Array
(
[TRXTYPE] => A
[TENDER] => C
[PARTNER] => PayPal
[USER] => XXXXX
[PWD] => XXXXX
[AMT] => 0
[ACCT] => 5105105105105100
[EXPDATE] => 1218
[INVNUM] => PONUM1
[VERBOSITY] => HIGH
[BILLTOZIP] => 95031
)
Response
Array
(
[RESULT] => 0
[PNREF] => A11A8C1A41C0
[RESPMSG] => Verified
[AUTHCODE] => 992PNI
[AVSADDR] => X
[AVSZIP] => X
[HOSTCODE] => A
[PROCAVS] => U
[TRANSTIME] => 2015-11-22 23:30:52
[AMT] => 0.00
[ACCT] => 5100
[EXPDATE] => 1218
[CARDTYPE] => 1
[IAVS] => X
[PREFPSMSG] => No Rules Triggered
[POSTFPSMSG] => No Rules Triggered
)
Now my question is I haven't provided CVV2 and also Any future date as EXPDATE gets verified. Can you please explain how things are working here? Also how can I verify CC, CVV and EXPDATE ?
This is simply creating the profile without any initial payment. As such, it's not going to validate the card at all. Of course, the first payment attempted on the profile would fail.
If you want to check the card prior to creating the profile you could run a credit card verification ($0 authorization).
So run the card verification first, and then only if that is successful you would follow up with a call to create the profile.
Keep in mind that if you're working in the sandbox any credit card expiration and security code will be accepted as long as it's not expired. This is done in the sandbox to make testing quick and easy.
If you would like to force errors in the API response so you can test those cases, take a look at the PayFlow documentation on testing.
Yes in the Test mode any future date for EXPDATE will be fine as Andrew mentioned . If you are looking for CVV value to be returned as "N" in the test mode then you can adjust the CVV values according to the docs below .
https://developer.paypal.com/webapps/developer/docs/classic/payflow/integration-guide/#testing-card-security-code
NVP Request:
VENDOR=XXX&PARTNER=Paypal&USER=XXXX&PWD=XXXX&TRXTYPE[1]=A&TENDER[1]=C&VERBOSITY=HIGH&ACCT[16]=5105105105105100&EXPDATE[4]=1020&AMT=0.00&**CVV2[3]=400**&COMMENT1[23]=Global Test Transaction&FIRSTNAME[4]=John&LASTNAME[5]=Smith&STREET=49354 Main&CITY[7]=SanJose&STATE[2]=CA&ZIP[5]=94303&COUNTRY[2]=US
NVP Response:
RESULT=0
PNREF=A71C8A7EA028
RESPMSG=Verified
AUTHCODE=010101
AVSADDR=N
AVSZIP=N
CVV2MATCH=N
HOSTCODE=A
RESPTEXT=100
PROCAVS=I8
PROCCVV2=N
TRANSTIME=2015-11-23 20:05:55
FIRSTNAME=John
LASTNAME=Smith
AMT=0.00
ACCT=5100
EXPDATE=1020
CARDTYPE=1
IAVS=N
PREFPSMSG=No Rules Triggered
POSTFPSMSG=No Rules Triggered
I am integrating PayPal Express Checkout for Digital Goods on my website and I am having trouble displaying the items which the user has selected on the PayPal review page -- the item displays but its name is cut off at 19 characters, which is not very lengthy for identifying something.
Is this just a limit of the interface, or is there something I can do to make the full name (or at least 40 or so characters of it) display? I know I'm passing in the full string because it shows if I hover over the truncated description.
If it is a limit of the interface, is it always 19 characters in every browser, including mobile? Is it by em-length? If I know this is the hard limit I can massage the item names so that I don't appear to be selling "Attending Membershi".
I'm using the basic code provided by the PayPal integration wizard. I'm filling my $items array to pass to SetExpressCheckoutDG in PHP like so:
$items[] = array('name' => 'Attending Membership for [convention and date]', 'amt' => $attending_cost, 'qty' => 1);
$resArray = SetExpressCheckoutDG( $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $items );
and then retrieving them with GetExpressCheckoutDetails and resending them via ConfirmPayment:
$res = GetExpressCheckoutDetails( $_REQUEST['token'] );
$items = array();
$i = 0;
while(isset($res["L_PAYMENTREQUEST_0_NAME$i"])) {
$items[] = array('name' => $res["L_PAYMENTREQUEST_0_NAME$i"], 'amt' => $res["L_PAYMENTREQUEST_0_AMT$i"], 'qty' => $res["L_PAYMENTREQUEST_0_QTY$i"]);
$i++;
}
$resArray = ConfirmPayment ( $token, $paymentType, $currencyCodeType, $payerID, $finalPaymentAmount, $items );
and getting this: http://i.imgur.com/9ST9mm7.png
PayPal checkout pages display the item name based on the layout that is rendered.
Item length supported for :
Digital Goods - 19 characters
Express Checkout (Physical) old layout = 35 characters
Express Checkout (Physical) new layout = 13 characters
In-Context Checkout - 19 Characters.
It's the intended behaviour to not to show the entire character length and shows upon hover
My intention is to create a Recurring Profile and pass a company_id as custom parameter to be stored IPN database, where I can create a relation between payment and for which company it was done.
I have read that while creating Recurring Payment Profile to get some custom value in IPN database, you should pass it in PROFILEREFERENCE parameter and then retrieve it from rp_invoice_id in response.
I cannot get the desired output
My request:
$inputData = array(
'METHOD' => 'CreateRecurringPaymentsProfile',
'TOKEN' => $_GET['token'], //get from GetExpressCheckout
'PAYERID' => $billerInfo['PAYERID'], //from GetExpressCheckout response
'PROFILESTARTDATE' => date("Y-m-d h:i:s", strtotime("+5 seconds")), //2012-05-11T00:00:00Z #Billing date start, in UTC/GMT format
'DESC' => 'LeaveBuddy: subscription amount is $' . $bill .' for the provided service ($12 per user per year).', //#Profile description - same as billing agreement description
'BILLINGPERIOD' => 'Year', #Period of time between billings
'BILLINGFREQUENCY' => 1,#Frequency of charges
'AMT' => 10, //Todo: dynamically calculate the amt #The amount the buyer will pay in a payment period
'CURRENCYCODE' => 'USD',#The currency, e.g. US dollars
'COUNTRYCODE' => 'US',#The country code, e.g. US
'MAXFAILEDPAYMENTS' => '0',#Maximum failed payments before suspension of the profile
'PROFILEREFERENCE' => 'companyid=1', //my custom value
);
The response that I am getting is:
{"InstantPaymentNotification":{"id":"553db30b-ea1c-4f68-8b5d-4fe5cbdd56cb","notify_version":"3.8","verify_sign":"A--8MSCLabuvN8L.-MHjxC9uypBtAQZom1C7.mbS1Jv-J898ZO0eeOr9","test_ipn":"1","address_city":null,"address_country":null,"address_country_code":null,"address_name":null,"address_state":null,"address_status":null,"address_street":null,"address_zip":null,"first_name":"code","last_name":"booster","payer_business_name":null,"payer_email":"codebooster#gmail.com","payer_id":"XXXXXXXX","payer_status":"verified","contact_phone":null,"residence_country":"US","business":null,"item_name":null,"item_number":null,"quantity":null,"receiver_email":"boom#gmail.com","receiver_id":null,"custom":null,"invoice":null,"memo":null,"option_name1":null,"option_name2":null,"option_selection1":null,"option_selection2":null,"tax":"0.00","auth_id":null,"auth_exp":null,"auth_amount":null,"auth_status":null,"num_cart_items":null,"parent_txn_id":null,"payment_date":null,"payment_status":null,"payment_type":null,"pending_reason":null,"reason_code":null,"remaining_settle":null,"shipping_method":null,"shipping":"0.00","transaction_entity":null,"txn_id":"316859739","txn_type":"recurring_payment","exchange_rate":null,"mc_currency":null,"mc_fee":null,"mc_gross":10,"mc_handling":null,"mc_shipping":null,"payment_fee":null,"payment_gross":null,"settle_amount":null,"settle_currency":null,"auction_buyer_id":null,"auction_closing_date":null,"auction_multi_item":null,"for_auction":null,"subscr_date":null,"subscr_effective":null,"period1":null,"period2":null,"period3":null,"amount1":null,"amount2":null,"amount3":null,"mc_amount1":null,"mc_amount2":null,"mc_amount3":null,"recurring":null,"reattempt":null,"retry_at":null,"recur_times":null,"username":null,"password":null,"subscr_id":null,"case_id":null,"case_type":null,"case_creation_date":null,"created":"2015-04-27 03:54:51","modified":"2015-04-27 03:54:51"},"PaypalItem":[]}
So i cannot find any [rp_invoice_id] parameter here, and my invoice is also appearing null. Can any one tell me what I am missing?
I'm trying to use a negative amount with the PayPal Adaptive Payments API. To start with, this seems to work:
'item' => [
{
'itemPrice' => '25.00',
'name' => 'Cryptex - 16Gb USB Drive',
'price' => '25',
'itemCount' => 1
},
{
'quantity' => 1,
'name' => 'Special Discount',
'price' => '-2.50'
},
{
'itemPrice' => '5.00',
'name' => 'Shipping',
'price' => '5.00',
'itemCount' => 1
}
]
Here is an example of what I see after submitting this as JSON, and updating the items:
As you can see, the price IS correct ... yet there is no sign of the discounted amount? Its obviously taking it into account - otherwise the price would have been £30, not £27.50 (which is after the £2.50 discount)
What gives? Is this a bug in PayPals system?
FWIW, the emails are also broken - they don't show the discount amount at all.
UPDATE: I've opened a ticket with PayPal tech support, as I'm pretty sure this is a bug with their system, and not something that can be fixed this end :( Damn annoying!
UPDATE 2: Reply from PayPal:
PayPal Adaptive Payments do not support negative item values. Since you did not pass the <itemPrice> in your API Call, the system did not throw the following error message:
[errorId] => 580022
[domain] => PLATFORM
[subdomain] => Application
[severity] => Error
[category] => Application
[message] => Invalid request parameter: itemPrice cannot be negative
I can see that the following was submitted to PayPal:
<item>
<name>Special Discount</name>
<identifier></identifier>
<price>-2.50</price>
<itemPrice></itemPrice>
<itemCount></itemCount>
<any>[quantity: null]</any>
</item>
This object is basically incomplete and in order to apply discounts, you should apply them > onto the price for the main item and then submit it to PayPal.
I'm really not sure what they're suggestion I do? An example cart, would be:
Item 1 - £10
Item 2 - £20
Item 3 - £50
Item 4 - £10
Delivery - £5
Total - £95
As an encouragement, we sometimes will offer coupons... so it could be "£10 off orders over £50". So in the above case above, it would drop the overall price to £85.
I'm really not sure what they are suggesting as an alternative?
Interesting. Normal payments don't have that restriction (I pass a negative amount item just like what you describe on a frequent basis).
What they're telling you to do is take the discount off another item. So your example cart with that discount would be
Item 1 - £10
Item 2 - £20
Item 3 - £40 <-- Removed £10 discount
Item 4 - £10
Delivery - £5
Total - £85 <-- total reflects this
So I'm playing around with the API, I've successfully created a credit card token.
stdClass Object
(
[id] => CARD-5SK44268VP850653PKMZB22Y
[state] => ok
[type] => visa
[number] => xxxxxxxxxxxx0331
[expire_month] => 11
[expire_year] => 2018
[first_name] => Mary
[last_name] => Shopper
[valid_until] => 2017-03-25T00:00:00Z
[create_time] => 2014-03-26T00:20:59Z
[update_time] => 2014-03-26T00:20:59Z
[links] => Array
(
[0] => stdClass Object
(
[href] => https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-5SK44268VP850653PKMZB22Y
[rel] => self
[method] => GET
)
[1] => stdClass Object
(
[href] => https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-5SK44268VP850653PKMZB22Y
[rel] => delete
[method] => DELETE
)
[2] => stdClass Object
(
[href] => https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-5SK44268VP850653PKMZB22Y
[rel] => patch
[method] => PATCH
)
)
)
I'm aware I can update and delete this if I remember the id, but what if I don't remember the ID to reference the card. How can I view all the credit cards I've created. If I forget the ID? It bothers me that I can create them and have them stuck theoretically on Paypal's server forever without a way to delete it through a console or any commands to bring me a list of them? Where exactly do the cards go? Do they disappear into the ether?
Is it possible to get a list of credit cards I've stored?
Any time a credit card is processed on PayPal's platform they save that data in their servers. Of course, they're fully PCI compliant so this isn't an issue for them (or buyers).
That card data is saved and related back to your transaction accordingly so that when you send a request to do a new payment using that card ID it can look it up and process it. So as far as the "where", it's simply PayPal's servers.
To my knowledge you cannot obtain a list of your saved cards.
The Credit Card resource allows you to retrieve all previously saved Credit Cards.
API used for it: '/v1/vault/credit-cards'
There are many possible filters that you could apply to it. For complete list, please refere to developer docs here.
use PayPal\Api\CreditCard;
"params = array(
"sort_by" => "create_time",
"sort_order" => "desc",
"merchant_id" => "Your Merchant ID" // Filtering by MerchantId set during CreateCreditCard.
);"
cards = CreditCard::all($params, $apiContext);
The Credit Card resource allows you to delete saved Credit Cards, You must have its unique creditCardId to perform delete
API used for it: /v1/vault/credit-card/{}
The CreditCard resource allows you to update previously saved Credit Cards. Please note that Credit card id is required for it.
API used for it: PATCH /v1/vault/credit-cards/
use PayPal\Api\CreditCard;
use PayPal\Api\Patch;
You could update a credit card by sending patch requests. Each path object would have a specific detail in the object to be updated.
pathOperation = new Patch();
pathOperation->setOp("replace")
->setPath('/expire_month')
->setValue("12");
To add Another Patch Object, You could set more than one patch while updating a credit card.
"pathOperation2 = new Patch();
pathOperation2->setOp('add')
->setPath('/billing_address')
->setValue(json_decode('{
"line1": "111 First Street",
"city": "Saratoga",
"country_code": "US",
"state": "CA",
"postal_code": "95070"
}'));
pathRequest = new \PayPal\Api\PatchRequest();
pathRequest->addPatch($pathOperation)
->addPatch($pathOperation2);"