Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 427
Michael Samteladze Avatar asked Nov 11 '22 01:11

Michael Samteladze


1 Answers

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

like image 60
Avi Das Avatar answered Dec 24 '22 09:12

Avi Das