Skip to content

2.0.0

Compare
Choose a tag to compare
@captn3m0 captn3m0 released this 02 Mar 10:38
· 281 commits to master since this release

Major upgrade with lots of changes:

Added

  • Adds require for all Razorpay supported entities. (Fixes #9 #16 #20 #27)
  • Adds customer edit API
  • Adds card fetch API
  • Adds custom header support
  • Adds constant time signature verification API for payments and webhooks. See Upgrade Notes below on usage
  • Adds payment capture-without-fetch API. See Upgrade Notes.
  • Upgraded httparty dependency

Changed:

  • Refund fetch has been changed. See Upgrade Notes.
  • All entity objects now throw NoMethodError instead of NameError if the attribute doesn't exist

Development:

  • Enables warnings for tests
  • Removes circular require calls
  • Now tested against ruby 2.4
  • Upgraded development dependencies.

Upgrade Notes

  • To fetch a collection of all refunds for a payment, you must now use payment_entity.refunds instead of payment_entity.refunds.all.

    Note that the older method will no longer work, and will throw a NoMethodError

    # v1
    Razorpay::Payment::fetch('payment_id').refunds.all
    => <Razorpay::Collection>
    
    # v2
    Razorpay::Payment::fetch('payment_id').refunds
    => <Razorpay::Collection>
    # v2
    Razorpay::Payment::fetch('payment_id').refunds.all
    => NoMethodError: undefined method `all' for #<Razorpay::Collection>
  • Payment can be captured without fetching it.

    # v1
    Razorpay::Payment.fetch('payment_id').capture({amount:500})
    # v2
    Razorpay::Payment.capture('payment_id', {amount:500})
  • Utility class can be used to verify signatures received from Razorpay

    • Payment response verification
     puts payment_response
     # {
     #   :razorpay_order_id   => "dummy_order_id",
     #   :razorpay_payment_id => "dummy_payment_id",
     #   :razorpay_signature  => "dummy_signature"
     # }
     Razorpay::Utility.verify_payment_signature(payment_response)

    You can find more details at the Orders API Documentation

    • Webhook verification
     Razorpay::Utility.verify_webhook_signature(webhook_signature, webhook_body)

    More details at the Webhooks Documentation