subscription creation with initial first payment

iceget
Contributor
Contributor

dear community,

 

on my website i have currently a subscription function where the user can "create a 10 euro" monthly payment subscription.

its working, but i have one problem:
1. if user creates the subscription, the users account will no charged "immediately", rather first after creation for the subscription (sometime in same minute, sometimes one hour later).

if now a user creates the subscription but have e.g. no money on his account, i get this information. but that is not good.

 

is there a possibility (and how) that i can charge the customer "instant" in the same time when the subscription was created?

how i should do that? is the the "setup fee"? which type of integrtion i should choose? i can this also change if needed.

 

also then if after the month if a user dont can be charged, whit which type of implementation it is easier?

did paypal have here more then only rest api for that? but what i only need is first inital payment + subscription creation,

then monthly subscription paments what i have to handle (also when not payed). sorry for that questions but  i a fresh in "paypal dev".

until now i have always worked with "single payments" what is simpler to handle.

 

thank you so much, many greet iceget

Login to Me Too
4 REPLIES 4

Nexus_Software
Contributor
Contributor

Hello @iceget ,

 

One way to achieve your desired outcome is to charge an initial setup fee when you create your plans. With the

 "setup_fee_failure_action": "CANCEL",

For example:

 

"payment_preferences": {
        "auto_bill_outstanding": true,
        "setup_fee": {
          "value": "10",
          "currency_code": "USD"
        },
        "setup_fee_failure_action": "CANCEL",
        "payment_failure_threshold": 0
      }

 

If the set up fee was the equivalent of one month, you could create the plan with a one month free trial.

 

Thank you.

 


Powered by Custom Software : NexWebSites.com
PayPal Developers

Login to Me Too

iceget
Contributor
Contributor

dear nexus software,

 

thank you, i know that but my integration works with "set express checkout", i need here the option InitialAmount and FailedInitialAmountAction but this is not working, can you maybe help me? i am using the set express checkout with CreateRecurringPaymentsProfile.

 

thank you

Login to Me Too

Nexus_Software
Contributor
Contributor

Hello @iceget ,

 

Are you using the Legacy name-value Pair (NVP) API call for your CreateRecurringPaymentsProfile  request?

If so, the Activation Details Fields:

 

INITAMT

(Optional) Initial non-recurring payment amount due immediately upon profile creation. Use an initial amount for enrollment or setup fees.

Note: All amounts included in the request must have the same currency.

 


FAILEDINITAMTACTION

(Optional) Action you can specify when a payment fails. Value is:

ContinueOnFailure — By default, PayPal suspends the pending profile in the event that the initial payment amount fails. You can override this default behavior by setting this field to ContinueOnFailure. Then, if the initial payment amount fails, PayPal adds the failed payment amount to the outstanding balance for this recurring payment profile.

 

When you specify ContinueOnFailure, a success code is returned to you in the CreateRecurringPaymentsProfile response and the recurring payments profile is activated for scheduled billing immediately. You should check your IPN messages or PayPal account for updates of the payment status.

 

CancelOnFailure — If this field is not set or you set it to CancelOnFailure, PayPal creates the recurring payment profile, but places it into a pending status until the initial payment completes. If the initial payment clears, PayPal notifies you by IPN that the pending profile has been activated. If the payment fails, PayPal notifies you by IPN that the pending profile has been canceled.

 

Can you post an example of the endpoint you're calling and the payload you're sending?

 

Thank you.

 

Powered by Custom Software : NexWebSites.com
PayPal Developers

Login to Me Too

iceget
Contributor
Contributor

dear nexus software,

 

yes, i am using NVP here are my complete request:

ExpressCheckout {#631 ▼
-client: Client {#633 ▼
-config: array:8 [▼
"curl" => array:2 [▼
32 => 6
64 => true
]
"handler" => HandlerStack {#636 ▼
-handler: Closure {#642 ▼
class: "GuzzleHttp\Handler\Proxy"
parameters: {▼
$request: {▼
typeHint: "Psr\Http\Message\RequestInterface"
}
$options: {▼
typeHint: "array"
}
}
use: {▼
$default: Closure {#641 …}
$streaming: StreamHandler {#638 …}
}
file: "/var/www/clients/client1/web19/web/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php"
line: "49 to 53"
}
-stack: array:4 [▼
0 => array:2 [▶]
1 => array:2 [▶]
2 => array:2 [▶]
3 => array:2 [▶]
]
-cached: null
}
"allow_redirects" => array:5 [▼
"max" => 5
"protocols" => array:2 [▼
0 => "http"
1 => "https"
]
"strict" => false
"referer" => false
"track_redirects" => false
]
"http_errors" => true
"decode_content" => true
"verify" => true
"cookies" => false
"headers" => array:1 [▼
"User-Agent" => "GuzzleHttp/6.3.3 curl/[Removed. Phone #s not permitted]20211119.61+debian10~1.gbp448fbe"
]
]
}
-httpClientConfig: array:2 [▼
32 => 6
64 => true
]
-certificate: ""
+mode: "live"
#post: Collection {#648 ▼
#items: array:20 [▼
"L_PAYMENTREQUEST_0_NAME0" => "product 1"
"L_PAYMENTREQUEST_0_AMT0" => 10
"L_PAYMENTREQUEST_0_DESC0" => "product 1"
"L_PAYMENTREQUEST_0_QTY0" => 1
"PAYMENTREQUEST_0_ITEMAMT" => 30
"PAYMENTREQUEST_0_AMT" => 30
"PAYMENTREQUEST_0_PAYMENTACTION" => "Sale"
"PAYMENTREQUEST_0_CURRENCYCODE" => "EUR"
"PAYMENTREQUEST_0_DESC" => "product 1"
"PAYMENTREQUEST_0_INVNUM" => "****"
"NOSHIPPING" => 1
"RETURNURL" => "***"
"CANCELURL" => "***"
"LOCALE" => "en_US"
"L_BILLINGTYPE0" => "RecurringPayments"
"L_BILLINGAGREEMENTDESCRIPTION0" => "product 1"
]
}
-config: array:12 [▼
"username" => "***"
"password" => "***"
"secret" => "***"
"certificate" => ""
"app_id" => ""
"signature" => "***"
"api_url" => "https://api-3t.paypal.com/nvp"
"gateway_url" => "https://www.paypal.com"
"ipn_url" => "https://ipnpb.paypal.com/cgi-bin/webscr"
"payment_action" => "Sale"
"notify_url" => ""
"locale" => ""
]
-subtotal: 30
-currency: "EUR"
-billingType: "MerchantInitiatedBilling"
-options: []
-paymentAction: "Sale"
-locale: "en_US"
-apiUrl: "https://api-3t.paypal.com/nvp"
-notifyUrl: ""
-httpBodyParam: "form_params"
-validateSSL: true
}

 

must i add INITAMT (or INITIALAMAOUN) and FAILEDINITAMTACTION after "L_BILLINGAGREEMENTDESCRIPTION0" => "product 1"?

 

how i can test this?

 

i only want create the subscription profile if the first payment was 100%, not before.

currently i work with the request without INITAMT. 

 

i had the problem that paypal creates the subscription but then if paypal (e.g. a few moments later) does the charge,

that paypal cannot charge the customer. 

 

can you maybe help me how i can handle that?

 

thank you so much many greets iceget

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.