
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Ruby gem for integrating with Sadad payment gateway. This gem provides complete functionality for creating and managing bills through Sadad's API.
Install the gem and add to the application's Gemfile by executing:
$ bundle add sadad
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install sadad
Next, you need to run the generator:
$ rails generate sadad:install
Note: This will create a config/initializers/sadad.rb
file with the default configuration.
Configure the gem with your configuration
Sadad.configure do |config|
config.merchant_id = "merchant_id"
config.program_id = "program_id"
config.client_certificate_pem_file = "client_certificate_pem_file"
end
For merchant_id
, program_id
, and client_certificate_pem_file
, you can set its value in 3 ways
Global across whole application (through initializer and configuration)
Sadad.configure do |config|
config.merchant_id = "merchant_id"
config.program_id = "program_id"
config.client_certificate_pem_file = "client_certificate_pem_file"
end
Per method or block (through the application variables). All consecutive requests will use that token until it is set to a different value
Sadad.merchant_id = "merchant_id"
Sadad.program_id = "program_id"
Sadad.client_certificate_pem_file = "client_certificate_pem_file"
Per request (through opts parameter)
Sadad::Bills.create(opts: { merchant_id: "merchant_id", program_id: "program_id", client_certificate_pem_file: "client_certificate_pem_file" })
Note: client_certificate_pem_file
should be set to the encoded file content of the certificate file using Base64. Use Base64.strict_encode64(File.read("path_to_file"))
to encode the file content.
Any API call will return an object with following methods:
result = Sadad.doSomething
result.success?
result.failure?
result.payload
result.error
Sadad::SingleBill.create(
user_national_id: "1133331101",
user_first_name: "Khaled",
user_last_name: "Ahmed",
invoice_id: "1998654321",
bill_type: "OneTime",
display_info: "Details of the invoice issued",
amount_due: 275.25,
invoice_created_date: "2025-02-23T10:46:37",
expiry_date: "2025-03-23T10:46:37"
opts: {}
)
Sadad::SingleBill.update(
user_national_id: "1133331101",
user_first_name: "Khaled",
user_last_name: "Ahmed",
invoice_id: "1998654321",
bill_type: "OneTime",
display_info: "Details of the invoice issued",
amount_due: 275.25,
invoice_created_date: "2025-02-23T10:46:37",
expiry_date: "2025-03-23T10:46:37",
opts: {}
)
Sadad::SingleBill.expire(
user_national_id: "1133331101",
user_first_name: "Khaled",
user_last_name: "Ahmed",
invoice_id: "1998654321",
bill_type: "OneTime",
display_info: "Details of the invoice issued",
amount_due: 275.25,
invoice_created_date: "2025-02-23T10:46:37",
expiry_date: "2025-03-23T10:46:37",
opts: {}
)
Sadad::SingleBill.inquiry(
sadad_number: "1998654321",
opts: {}
)
invoices = [
{
user_national_id: "1133331101",
user_first_name: "Khaled",
user_last_name: "Ahmed",
invoice_id: "1998054111",
invoice_status: "BillNew",
bill_type: "OneTime",
display_info: "Details of the invoice issued",
amount_due: 275.25,
invoice_created_date: "2025-02-23T10:46:37",
expiry_date: "2025-03-23T10:46:37"
},
{
user_national_id: "1983331102",
user_first_name: "Ahmed",
user_last_name: "Ali",
invoice_id: "1998254321",
invoice_status: "BillNew",
bill_type: "Recurring",
display_info: "Monthly subscription payment",
amount_due: 5000.00,
invoice_created_date: "2025-02-23T10:46:37",
expiry_date: "2025-03-23T10:46:37",
minimum_partial_amount: 500
}
]
Sadad::MultipleBills.create(invoices, opts: {})
Sadad::MultipleBills.deactivate(sadad_numbers: ["1998654321", "1998654322"], opts: {})
Errors could be one of the following:
Sadad::ForbiddenError
Sadad::APIConnectionError
Sadad::APIError
Sadad::InvalidRequestError (With `param` attribute)
Bug reports and pull requests are welcome.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that sadad demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.