7
I’m doing the Paypal Express Checkout API integration.
When the paying customer actually goes to the Paypal website to enter his or her details in order to make the payment, you are presented with the following options:
- Payment with Paypal account
- Payment by Credit Card
Problem
In this particular integration, the payments to be made via Paypal must be limited to Paypal accounts, that is, the credit card option must be unavailable or not appear in full.
In the API documentation (English) I have not found any reference to this or option to indicate that I do not want the credit card option to be displayed.
Parameters sent to the API
In the function below, the various parameters are prepared that indicate to the API what is intended to be presented to the paying person as well as the layout of the page on the Paypal side:
/**
* CALL SHORTCUT EXPRESS CHECKOUT
*
* Prepares the parameters for the SetExpressCheckout API Call.
*
* @param string $token Internal security token
* @param string $cartLinesArr The cart lines to build the url string.
* @param string $cartTotalsArr The cart products and delivery total.
*
* @return array Response array from Paypal
*/
public function callShortcutExpressCheckout($token, $cartLinesArr, $cartTotalsArr) {
//get all details about this transaction
$transactionArr = $this->getClientData($cartTotalsArr);
/*
* Buyers Address and Contacts
*/
$shiptoAddress = "&SHIPTONAME=" . urlencode($transactionArr["firstName"]." ".$transactionArr["lastName"]);
$shiptoAddress.= "&SHIPTOSTREET=" . urlencode($transactionArr["address"]);
$shiptoAddress.= "&SHIPTOSTREET2=" . urlencode($transactionArr["address2"]);
$shiptoAddress.= "&SHIPTOCITY=" . urlencode($transactionArr["city"]);
$shiptoAddress.= "&SHIPTOSTATE=" . urlencode($transactionArr["state"]);
$shiptoAddress.= "&SHIPTOCOUNTRYCODE=" . urlencode($transactionArr["countryCode"]);
$shiptoAddress.= "&SHIPTOZIP=" . urlencode($transactionArr["zipCode"]);
$shiptoAddress.= "&SHIPTOPHONENUM=" . urlencode($transactionArr["contact"]);
/*
* Cart Items
*/
$PAYPAL_CART_ITEMS = "";
$c = 0;
if ($cartLinesArr) {
foreach ($cartLinesArr as $cartLine) {
$PAYPAL_CART_ITEMS.= "&L_PAYMENTREQUEST_0_NUMBER" . $c . "=" . urlencode($cartLine["id"]);
$PAYPAL_CART_ITEMS.= "&L_PAYMENTREQUEST_0_NAME" . $c . "=" . urlencode($cartLine["name"]);
$PAYPAL_CART_ITEMS.= "&L_PAYMENTREQUEST_0_AMT" . $c . "=" . urlencode($cartLine["price"]);
$PAYPAL_CART_ITEMS.= "&L_PAYMENTREQUEST_0_QTY" . $c . "=" . urlencode($cartLine["quantity"]);
$c++;
}
}
/*
* Construct the parameter string that describes the
* SetExpressCheckout API call in the shortcut implementation
*/
$nvpstr = "&PAYMENTREQUEST_0_AMT=" . urlencode(numberFormat($transactionArr["shippingVal"]+$transactionArr["chargeValue"]));
$nvpstr.= "&PAYMENTREQUEST_0_ITEMAMT=" . urlencode($transactionArr["chargeValue"]);
$nvpstr.= "&PAYMENTREQUEST_0_SHIPPINGAMT=" . urlencode($transactionArr["shippingVal"]);
$nvpstr.= "&PAYMENTREQUEST_0_PAYMENTACTION=" . urlencode(PAYPAL_PAYMENT_TYPE);
$nvpstr.= "&PAYMENTREQUEST_0_CURRENCYCODE=" . urlencode(PAYPAL_CURRENCY_CODE_TYPE);
$nvpstr.= "&RETURNURL=" . urlencode(PAYPAL_RETURN_URL.$token);
$nvpstr.= "&CANCELURL=" . urlencode(PAYPAL_CANCEL_URL.$token);
$nvpstr.= "&ADDRESSOVERRIDE=1";
$nvpstr.= $shiptoAddress;
$nvpstr.= "&ALLOWNOTE=" . urlencode(PAYPAL_ALLOWNOTE);
$nvpstr.= "&HDRIMG=" . urlencode(PAYPAL_USE_LOGOTYPE);
$nvpstr.= "&LOCALECODE=" . urlencode(PAYPAL_LOCAL_CODE);
$nvpstr.= "&EMAIL=" . urlencode($transactionArr["email"]);
$nvpstr.= $PAYPAL_CART_ITEMS;
$nvpstr.= "&LANDINGPAGE=" . urlencode(PAYPAL_LANDING_PAGE);
$nvpstr.= "&NOTETOBUYER=" . urlencode(I18N_ESHOP_PAYPAL_NOTES);
/*
* Make the API call to PayPal
*/
return $this->hash_call("SetExpressCheckout", $nvpstr);
}
Question
How to pass a parameter to the Paypal API so that the same limit the payment options that are presented to the paying customer, where it is only intended to accept payments via Paypal accounts?
when vc "Pay by card" in paypal, it asks email and password, creating an account for the user, or is not like this anymore?
– hernandev
@Now, I assume it’s still that way, but the question here is: Credit Card Payments have a high rate and my client intends, in such cases, to resort to a solution other than Paypal. However, as a very potential customer has a Paypal account, he intends to accept these paypal account payments to paypal account.
– Zuul
but after logging in, there is still the possibility to pay with Credit Card, after logging in
– hernandev
I believe that Paypal does not offer these conditions, please see https://developer.paypal.com/webapps/developer/docs/classic/admin/setup-account/#id095FF4006HS
– hernandev
@Ernandes This with "Express Checkout" ? The paying customer goes from the web-site to Paypal, identifies himself paid and is "wiped" to the web-site again... If you indicate that he cannot use a Credit Card, you only get a chance to pay with money in your paypal account. I think we have resolved the issue as a whole (if there really is such a parameter or way of controlling this)!
– Zuul
@Thanks for this link, I’ve been reading and gave tips to conduct research on the subject otherwise... I’m trying to find more information!
– Zuul
In the Setexpresscheckout Api just add:
solutiontype=mark
– miguel