Michael Samteladze
Michael Samteladze

Reputation: 1330

paypal subscription with immediate first payment

I'm trying to set up recurring payment with immediate first payment.

For example you buy some monthly subscription on my website for $10. I take first $10 immediately and then I continue charge $10 monthly.

My problem is that I can't set up first immediate payment.

I use REST API:

https://developer.paypal.com/docs/api/#create-a-plan

Here is my JSON

{
    name = Caption,
    description = "Some Description"
    type = "INFINITE",
    payment_definitions = 
    [
        {
            name = "Some Name"
            type ="REGULAR",
            frequency = "DAY",
            frequency_interval = 1,
            amount = new 
            {
                value = 10,
                currency = "USD"
            },
            cycles = "0"
        }
    ],
    merchant_preferences
    {
        setup_fee = new
        {
            value = 10,
            currency = "USD"
        },
        cancel_url = CancelUrl,
        return_url = ReturnUrl,
        max_fail_attempts = "5"
    }
};

What should I add to my json, to make paypal take first payment immediately.

Thanks.

Edited:

I could find out some strange behavior: My timezone is (UTC+04:00) Tbilisi. If I set up a transaction before 14:00 it processes immediately, but if I do it after, I have to wait until next day.

Upvotes: 5

Views: 1905

Answers (3)

Goku kun
Goku kun

Reputation: 13

On the official documentation for subscriptions API, I noticed there is a property called application_context.

"application_context": {
  "payment_method": {
    "payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED",
  }
}

Adding this in the post request should change the first payment to be processed immediately.

Link to the documentation: https://developer.paypal.com/docs/api/subscriptions/v1/

Upvotes: 0

Jacky Lormoz
Jacky Lormoz

Reputation: 165

Is only in sandbox is didn't work?

I've try a +1day (made the 24, and in the client, the first payment is for the 25) and nothing is transfered...

Upvotes: 0

Avi Das
Avi Das

Reputation: 1723

If the $10 is a one time payment then you should have it as the setup fee. The setup fee should be immediately processed.

Upvotes: 1

Related Questions