コード例 #1
0
def initiate_new_plan():
    """Set a new installment plan for the returning shopper"""
    # TODO: Fill-in the data
    resp = api_client.InstallmentPlanApi.installment_plan_initiate(
        splitit.InitiateInstallmentPlanRequest(
            plan_data=splitit.PlanData(
                auto_capture=True,
                amount=splitit.MoneyWithCurrencyCode(300, "USD"),
                number_of_installments=3,
                ref_order_number="abc123",
            ),
            payment_wizard_data=splitit.PaymentWizardData(
                requested_number_of_installments="2,3,4,5,6", ),
            billing_address=splitit.AddressData2(
                address_line="260 Madison Avenue.",
                city="New York",
                state="NY",
                country="USA",
                zip="10016",
            ),
            consumer_data=splitit.ConsumerData(
                full_name="John Smith",
                email="*****@*****.**",
                phone_number="1-415-775-4848",
                culture_name="en-us",
            ),
        ))
    return resp
コード例 #2
0
def initiate_installment_plan():
    resp = api_client.InstallmentPlanApi.installment_plan_initiate(
        splitit.InitiateInstallmentPlanRequest(
            plan_data=splitit.PlanData(
                auto_capture=True,
                amount=splitit.MoneyWithCurrencyCode(600, "USD"),
                number_of_installments=3,
                ref_order_number="abc123",
            ),
            payment_wizard_data=splitit.PaymentWizardData(
                requested_number_of_installments="2,3,4,5,6", ),
            billing_address=splitit.AddressData2(
                address_line="260 Madison Avenue.",
                city="New York",
                state="NY",
                country="USA",
                zip="10016",
            ),
            consumer_data=splitit.ConsumerData(
                full_name="John Smith",
                email="*****@*****.**",
                phone_number="1-415-775-4848",
                culture_name="en-us",
            ),
            credit_card_details=splitit.CardData(
                card_holder_full_name="John Smith",
                card_number="4111111111111111",
                card_exp_year="2022",
                card_exp_month="8",
                card_cvv="123",
            ),
        ))
    return resp
def initiate_installment_plan(transactionValue):
    """Use as a handler for Checkout request"""
    # TODO: Customize the data
    resp = api_client.InstallmentPlanApi.installment_plan_initiate(
        splitit.InitiateInstallmentPlanRequest(
            plan_data=splitit.PlanData(
                auto_capture=True,
                amount=splitit.MoneyWithCurrencyCode(transactionValue, "USD"),
                number_of_installments=3,
                ref_order_number="abc123",
                # Request 50% of the transaction as a first installment
                first_installment_amount=splitit.MoneyWithCurrencyCode(
                    0.5 * transactionValue, "USD"),
                # Delay first charge for a week
                first_charge_date=datetime.now() + timedelta(days=7)),
            payment_wizard_data=splitit.PaymentWizardData(
                requested_number_of_installments="2,3,4,5,6", ),
            # Optional data to pre-fill the form
            billing_address=splitit.AddressData2(
                address_line="260 Madison Avenue.",
                city="New York",
                state="NY",
                country="USA",
                zip="10016",
            ),
            # Optional data to pre-fill the form
            consumer_data=splitit.ConsumerData(
                full_name="John Smith",
                email="*****@*****.**",
                phone_number="1-415-775-4848",
                culture_name="en-us",
            ),
            # After user successfully interacts with splitit.com they would be
            # redirected to provided Succeeded URL with InstallmentPlanNumber as
            # a parameter in GET request. It is required to continue the flow.
            redirect_urls=splitit.RedirectUrls(
                succeeded="http://localhost/Succeeded",
                canceled="http://localhost/Canceled",
                failed="http://localhost/Failed",
            ),
        ))

    # TODO: Redirect customer to initPaymentResp.CheckoutUrl
    print("Go to {}\n".format(resp.checkout_url))
    return resp