Skip to content

Added new billing amount breakdown #1562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
May 13, 2025
Merged

Conversation

stechiu
Copy link
Collaborator

@stechiu stechiu commented Apr 28, 2025

We are expanding support of RBA metadata to the PayPal Checkout Vault with Purchase flow. New parameters have been added to RBA, particularly Billing Amount Breakdown.

Path: /v1/paypal_hermes/create_payment_resource

Post Body:

"plan_metadata": {
        "billing_cycles": [{
            "billing_frequency": 1,
            "billing_frequency_unit": "MONTH",
            "number_of_executions": 1,
            "sequence": 1,
            "start_date": "2024-04-06T00:00:00Z",
            "trial": true,
            "pricing_scheme": {
                "pricing_model": "FIXED",
                "price": "9.99",
                "reload_threshold_amount": "99.99"
            }
        }],
        "currency_iso_code": "USD",
        "name": "Netflix w/ Ads",
🆕      "unit_amount": "20.00",
        "product_description": "iPhone 13",
        "product_quantity": 1,
        "one_time_fee_amount": "9.99",
        "shipping_amount": "1.99",
        "product_price": "19.99",
        "tax_amount": "0.59",
        "total_amount": "32.56",
🆕      "amount_breakdown": {
          "item_total": "20.00",
          "shipping": "0.99",
          "handling": "0.99",
          "tax_total": "1.99",
          "insurance": "0",
          "shipping_discount": "0",
          "discount" : "0"
        }
    }
}

Summary of changes

  • Add unitAmount of type String to BTPayPalRecurringBillingDetails
  • Add new BTRecurringBillingAmountBreakdown class: itemTotal, shipping, handling, taxTotal, insurance, shippingDiscount, discount
  • Add amountBreakdown of type BTRecurringBillingAmountBreakdown to BTPayPalRecurringBillingDetails
  • Add recurringBillingDetails and recurringBillingPlanType to BTPayPalCheckoutRequest

Checklist

  • Added a changelog entry
  • Tested and confirmed payment flows affected by this change are functioning as expected

Authors

List GitHub usernames for everyone who contributed to this pull request.

@stechiu stechiu requested a review from a team as a code owner April 28, 2025 19:38
@stechiu stechiu changed the base branch from main to checkout-rba-metadata-feature April 28, 2025 22:08
…down.swift

Co-authored-by: Jax DesMarais-Leder <jdesmarais@paypal.com>
@richherrera richherrera self-requested a review May 8, 2025 15:20
@richherrera richherrera self-requested a review May 8, 2025 15:36
stechiu and others added 4 commits May 8, 2025 15:12
Co-authored-by: Jax DesMarais-Leder <jdesmarais@paypal.com>
import Foundation

/// A recurring billing amount breakdown.
///
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove extra comment line

Suggested change
///
///

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had suggested this in an earlier PR to improve readability. :)

@@ -5,7 +5,7 @@ import XCTest
class BTPayPalLineItem_Tests: XCTestCase {

func testUPCTypeStringReturnsCorrectValue() {
var lineItem = BTPayPalLineItem(quantity: "1", unitAmount: "10", name: "item-name", kind: .debit)
let lineItem = BTPayPalLineItem(quantity: "1", unitAmount: "10", name: "item-name", kind: .debit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious why we need to change from var to let here

Copy link
Contributor

@agedd agedd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great to me, just added a few minor comments

import Foundation

/// A recurring billing amount breakdown.
///
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had suggested this in an earlier PR to improve readability. :)

@stechiu stechiu merged commit 5b0fd05 into checkout-rba-metadata-feature May 13, 2025
7 checks passed
@stechiu stechiu deleted the rba-amount branch May 13, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants