Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

CreateRecurringPaymentsProfile example not working on production #105

Closed
GhaziTriki opened this issue Apr 4, 2016 · 16 comments
Closed

CreateRecurringPaymentsProfile example not working on production #105

GhaziTriki opened this issue Apr 4, 2016 · 16 comments

Comments

@GhaziTriki
Copy link

Hi,

I had some issues to implement CreateRecurringPaymentsProfile in production because the example for sandbox is incomplete, mandatory fileds for the credit card were missing. Do you accept a pull request containing the update?

@randstraw
Copy link

Yes, please submit a pull request so it can be reviewed.

@GhaziTriki
Copy link
Author

I just got an answer from PayPal support few days ago. I will provide a pull request as soon as I can.

@randstraw randstraw added the bug label May 19, 2016
@Mahesh-xpertech
Copy link

Hi,
I have problem with CreateRecurringPaymentsProfile with credit card details.I am using sandbox mode.

@randstraw
Copy link

@Mahesh-xpertech can you provide the error response? Ensure you provide the correlation id from the response as well please.

@Mahesh-xpertech
Copy link

Ack :
Failure
ProfileID :

PayPal\PayPalAPI\CreateRecurringPaymentsProfileResponseType Object
(
[CreateRecurringPaymentsProfileResponseDetails] => PayPal\EBLBaseComponents\CreateRecurringPaymentsProfileResponseDetailsType Object
(
[ProfileID] =>
[ProfileStatus] =>
[TransactionID] =>
[DCCProcessorResponse] =>
[DCCReturnCode] =>
)

[Timestamp] => 2016-10-26T11:51:06Z
[Ack] => Failure
[CorrelationID] => ab1501d7a4074
[Errors] => Array
    (
        [0] => PayPal\EBLBaseComponents\ErrorType Object
            (
                [ShortMessage] => DPRP is disabled.
                [LongMessage] => DPRP is disabled for this merchant.
                [ErrorCode] => 11586
                [SeverityCode] => Error
                [ErrorParameters] => 
            )

    )

[Version] => 106.0
[Build] => 000000

)

@Mahesh-xpertech
Copy link

@pp-randy
Sir Code that I am using below to create Recurring Payment with credit card info

Name='test'; $AddressType->Street1='Street1'; $AddressType->Street2='Street2'; $AddressType->CityName='Mohali'; $AddressType->StateOrProvince='dd'; $AddressType->Country='US'; $AddressType->CountryName='India'; $AddressType->Phone='8960915320'; $AddressType->PostalCode='232109'; $RPProfileDetails = new RecurringPaymentsProfileDetailsType(); $RPProfileDetails->SubscriberName='Mahesh'; $RPProfileDetails->BillingStartDate='2016-012-26T00:00:00:000Z'; $RPProfileDetails->SubscriberShippingAddress=$AddressType; $activationDetails = new ActivationDetailsType(); $activationDetails->InitialAmount = new BasicAmountType('USD','10'); $activationDetails->FailedInitialAmountAction ='ContinueOnFailure'; $paymentBillingPeriod = new BillingPeriodDetailsType(); $paymentBillingPeriod->BillingFrequency ='1'; $paymentBillingPeriod->BillingPeriod = 'Month'; $paymentBillingPeriod->TotalBillingCycles = '1'; $paymentBillingPeriod->Amount = new BasicAmountType($currencyCode, '10'); $paymentBillingPeriod->ShippingAmount = new BasicAmountType($currencyCode, $_REQUEST['paymentShippingAmount']); $paymentBillingPeriod->TaxAmount = new BasicAmountType($currencyCode, '0'); $scheduleDetails = new ScheduleDetailsType(); $scheduleDetails->Description='recurring billing'; $scheduleDetails->TrialPeriod='Month'; $scheduleDetails->PaymentPeriod='1'; $scheduleDetails->ActivationDetails = $activationDetails; $trialBillingFrequency=4; $trialAmount=10; ``` $trialBillingPeriod = new BillingPeriodDetailsType(); $trialBillingPeriod->BillingFrequency = 4; $trialBillingPeriod->BillingPeriod = 'Day'; $trialBillingPeriod->TotalBillingCycles = '1'; $trialBillingPeriod->Amount = new BasicAmountType($currencyCode, '10'); $trialBillingPeriod->ShippingAmount = new BasicAmountType($currencyCode, '0'); $trialBillingPeriod->TaxAmount = new BasicAmountType($currencyCode, '0'); $scheduleDetails->TrialPeriod = $trialBillingPeriod; ``` $scheduleDetails->PaymentPeriod = $paymentBillingPeriod; $maxfailedpayments=0; $autoBillOutstandingAmount='NoAutoBill'; $scheduleDetails->MaxFailedPayments = $maxfailedpayments; $scheduleDetails->AutoBillOutstandingAmount = $autoBillOutstandingAmount; $createRPProfileRequestDetail = new CreateRecurringPaymentsProfileRequestDetailsType(); $creditCard = new CreditCardDetailsType(); $creditCard->CreditCardNumber ='4311193154103039'; $creditCard->CreditCardType ='Visa'; $creditCard->CVV2 = '123'; $creditCard->ExpMonth =11; $creditCard->ExpYear = 2021; $createRPProfileRequestDetail->CreditCard = $creditCard; $createRPProfileRequestDetail->ScheduleDetails = $scheduleDetails; $createRPProfileRequestDetail->RecurringPaymentsProfileDetails = $RPProfileDetails; $createRPProfileRequest = new CreateRecurringPaymentsProfileRequestType(); $createRPProfileRequest->CreateRecurringPaymentsProfileRequestDetails = $createRPProfileRequestDetail; $createRPProfileReq = new CreateRecurringPaymentsProfileReq(); $createRPProfileReq->CreateRecurringPaymentsProfileRequest = $createRPProfileRequest; $paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig()); try { /\* wrap API method calls on the service object with a try catch */ $createRPProfileResponse = $paypalService->CreateRecurringPaymentsProfile($createRPProfileReq); } catch (Exception $ex) { include_once("../Error.php"); exit; } if(isset($createRPProfileResponse)) { echo ""; echo ""; echo ""; echo "
Ack :
$createRPProfileResponse->Ack
ProfileID :
".$createRPProfileResponse->CreateRecurringPaymentsProfileResponseDetails->ProfileID ."
"; ``` echo "
";
print_r($createRPProfileResponse);
echo "
"; ``` } require_once '../Response.php';

@randstraw
Copy link

@Mahesh-xpertech can you try now please?

@Mahesh-xpertech
Copy link

@pp-randy Now this code return ack is success but transaction is not showing in the sandbox transaction list.

@Mahesh-xpertech
Copy link

@pp-randy My response is below from paypal
Ack :
Success
ProfileID :
I-KLNS1LAJF1DG

PayPal\PayPalAPI\CreateRecurringPaymentsProfileResponseType Object
(
[CreateRecurringPaymentsProfileResponseDetails] => PayPal\EBLBaseComponents\CreateRecurringPaymentsProfileResponseDetailsType Object
(
[ProfileID] => I-KLNS1LAJF1DG
[ProfileStatus] => PendingProfile
[TransactionID] => 9JX28936K6753834Y
[DCCProcessorResponse] =>
[DCCReturnCode] =>
)

[Timestamp] => 2016-10-27T05:28:27Z
[Ack] => Success
[CorrelationID] => a925ca727841
[Errors] => 
[Version] => 106.0
[Build] => 24616352

)

@randstraw
Copy link

I reviewed the transaction and it is associated to your sandbox test account. You would need to log into the sandbox test account at https://www.sandbox.paypal.com.

I apologize for the confusion to provide more details the the Sandbox Transactions listed here: https://developer.paypal.com/developer/dashboard/sandbox/, these are for the REST API and the SDK for that is here: https://github.com/paypal/PayPal-PHP-SDK

The above it my assumption of what you might be experiencing. If this is the case please provide more details around where the transaction is missing and I help further.

@Mahesh-xpertech
Copy link

@pp-randy I am using direct payment of sample code but transaction is not showing in the transaction sandbox.. sir Plz help me with any problem with following Code

Name = "$firstName $lastName"; $address->Street1 = $_POST['address1']; $address->Street2 = $_POST['address2']; $address->CityName = $_POST['city']; $address->StateOrProvince = $_POST['state']; $address->PostalCode = $_POST['zip']; $address->Country = $_POST['country']; $address->Phone = $_POST['phone']; $paymentDetails = new PaymentDetailsType(); $paymentDetails->ShipToAddress = $address; /* - Total cost of the transaction to the buyer. If shipping cost and tax charges are known, include them in this value. If not, this value should be the current sub-total of the order. If the transaction includes one or more one-time purchases, this field must be equal to the sum of the purchases. Set this field to 0 if the transaction does not include a one-time purchase such as when you set up a billing agreement for a recurring payment that is not immediately charged. When the field is set to 0, purchase-specific fields are ignored. - `Currency Code` - You must set the currencyID attribute to one of the 3-character currency codes for any of the supported PayPal currencies. - `Amount` _/ $paymentDetails->OrderTotal = new BasicAmountType('USD', $_POST['amount']); /_ - Your URL for receiving Instant Payment Notification (IPN) about this transaction. If you do not specify this value in the request, the notification URL from your Merchant Profile is used, if one exists. */ if(isset($_REQUEST['notifyURL'])) { $paymentDetails->NotifyURL = $_REQUEST['notifyURL']; } $personName = new PersonNameType(); $personName->FirstName = $firstName; $personName->LastName = $lastName; //information about the payer $payer = new PayerInfoType(); $payer->PayerName = $personName; $payer->Address = $address; $payer->PayerCountry = $_POST['country']; $cardDetails = new CreditCardDetailsType(); $cardDetails->CreditCardNumber = $_POST['creditCardNumber']; /* * Type of credit card. For UK, only Maestro, MasterCard, Discover, and Visa are allowable. For Canada, only MasterCard and Visa are allowable and Interac debit cards are not supported. It is one of the following values: - Visa - MasterCard - Discover - Amex - Solo - Switch - Maestro: See note. `Note: If the credit card type is Maestro, you must set currencyId to GBP. In addition, you must specify either StartMonth and StartYear or IssueNumber.` */ $cardDetails->CreditCardType = $_POST['creditCardType']; $cardDetails->ExpMonth = $_POST['expDateMonth']; $cardDetails->ExpYear = $_POST['expDateYear']; $cardDetails->CVV2 = $_POST['cvv2Number']; $cardDetails->CardOwner = $payer; $ddReqDetails = new DoDirectPaymentRequestDetailsType(); $ddReqDetails->CreditCard = $cardDetails; $ddReqDetails->PaymentDetails = $paymentDetails; $ddReqDetails->PaymentAction = $_REQUEST['paymentType']; $doDirectPaymentReq = new DoDirectPaymentReq(); $doDirectPaymentReq->DoDirectPaymentRequest = new DoDirectPaymentRequestType($ddReqDetails); /* - ## Creating service wrapper object Creating service wrapper object to make API call and loading Configuration::getAcctAndConfig() returns array that contains credential and config parameters _/ $paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig()); try { /_ wrap API method calls on the service object with a try catch */ $doDirectPaymentResponse = $paypalService->DoDirectPayment($doDirectPaymentReq); } catch (Exception $ex) { include_once("../Error.php"); exit; } if(isset($doDirectPaymentResponse)) { echo ""; echo ""; echo ""; echo "
Ack :
$doDirectPaymentResponse->Ack
TransactionID :
$doDirectPaymentResponse->TransactionID
"; echo "
";
  print_r($doDirectPaymentResponse);
  echo "
"; } require_once '../Response.php'; ?>

@randstraw
Copy link

randstraw commented Oct 27, 2016

Which URL are you not seeing the transaction on? I can see them on your sandbox account.

Example: You recently created 63W45731FD302724U for $10.00.

@Mahesh-xpertech
Copy link

@pp-randy
using below URL for seeing transaction but it is not listed in...
https://developer.paypal.com/developer/dashboard/sandbox/
Merchant Account is credited every time but buyer account is not debited(decreased) any single time

@Mahesh-xpertech
Copy link

@pp-randy
Now the current transaction id is 93C76230BE3561808 and not listed in the transaction account.

@randstraw
Copy link

Your transactions will not show in that URL because they are not created with the REST API. Please review this previous comment.

You would need to log into the sandbox test account at https://www.sandbox.paypal.com.

From here: #105 (comment)

@randstraw
Copy link

If you do not know the password for your merchant sandbox account to log into https://www.sandbox.paypal.com you can change it here: https://developer.paypal.com/developer/accounts/ and then click the Profile link for that account.

@randstraw randstraw removed the bug label Nov 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants