
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
A Ruby library for interacting with v1 of the Pin Payments API.
Add this line to your application's Gemfile:
gem 'pin-ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pin-ruby
The Pin library includes a generator to create a config file and initializer for you:
$ rails g pin:install --publishable-key your_key_here --secret-key your_secret_here
The generator adds two files for your rails project:
Customise the config/pin.yml config file if you wish to use different publishable keys per environment (by default it uses the same token in development, test and production).
The Pin library is configured during rails initialization using the generated files, and no further configuration is necessary before use.
When using the Pin library in a non-rails application, you must configure it to use your Pin publishable key manually:
Pin.configure do |config|
config.publishable_key = 'YOUR_PUBLISHABLE_KEY'
config.secret_key = 'YOUR_SECRET_KEY'
config.endpoint = 'api.pin.net.au'
end
require 'pin/api'
client = Pin::API::Client.new()
Return a paginated list of Pin::Models::Charge
objects:
client.charges()
Optionally pass the page
parameter to specify a different page of results:
client.charges(2)
Will get the second page of charges.
Get a specific customer by their token:
client.charge('ch_1234')
Returns a Pin::Models::Charge
object, or raises a Pin::Error
:
HTTP Error 404: not_found
Search for charges by description, amount and date, as per Pin's Documentation:
client.charge_search({:query => 'Test Transaction'})
Returns a paginated list of Pin::Models::Charges
.
Charges a customer or card, and returns the newly created charge object:
client.create_charge('me@some.net', 'Test Transaction', '1295', 'AUD', request.remote_ip, 'cus_1234')
The last parameter (token_or_card
) can be either a customer token, a card token or a card hash.
Returns a Pin::Models::Charge
of the charge, or a Pin::Error
, as per Pin's Documentation.
Return a paginated list of Pin::Models::Customer
objects:
client.customers()
Optionally pass the page
parameter to specify a different page of results:
client.customers(2)
Will get the second page of customers.
Get a specific customer by their token:
client.customer('cus_1234')
Returns a Pin::Models::Customer
object, or raises a Pin::Error
:
HTTP Error 404: not_found
Gets a paginated list of charges against a customer:
client.customer_charges('cus_1234')
Optionally pass a second parameter page
to specify a different page of results:
client.customer_charges('cus_1234', 2)
Returns a list of Pin::Models::Charge
object, or raises a Pin::Error
:
HTTP Error 404: not_found
Create a new customer with either an existing card token, or a hash of card details):
client.create_customer('me@some.net', 'card_1234')
or
client.create_customer('me@some.net', {:number => '5520000000000000', ... })
Card hash should be supplied as per Pin's documentation:
{
"token": "card_nytGw7koRg23EEp9NTmz9w",
"display_number": "XXXX-XXXX-XXXX-0000",
"scheme": "master",
"address_line1": "42 Sevenoaks St",
"address_line2": null,
"address_city": "Lathlain",
"address_postcode": "6454",
"address_state": "WA",
"address_country": "Australia"
}
Returns the newly created customer as a Pin::Models::Customer
object.
Update's a customer's card and/or email address:
client.update_customer('cus_1234', {:email => 'new@some.net', :card => {:number => '5520000000000000', ... } })
Returns the updated customer as a Pin::Models::Customer
object.
Return a paginated list of Pin::Models::Refund
objects for the specified charge token:
client.refunds('ch_1234')
Optionally pass the page
parameter to specify a different page of results:
client.refunds('ch_1234', 2)
Will get the second page of refunds for the specified charge.
Refunds the specified amount against an existing charge, and returns the refund object created, or a Pin::Error
:
client.create_refund('ch_1234')
By default create_refund
refunds the full amount of the original charge. To specify a different amount, pass the amount as cents to the optional second parameter:
client.create_refund('ch_1234', '1000')
Returns the refund object created, or a Pin::Error
.
Takes a card and stores it returning a reusable token for charges.
client.create_token('5520000000000000', '01', '2015', '123', 'John Appleseed', {
:line1 => '1 Main Street',
:city => 'Melbourne',
:postcode => '3000',
:state => 'Victoria',
:country => 'Australia'
})
Returns a Pin::Models::Card
containing the non-sensitive card details.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that pin-ruby demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.