2016-02-21 23:00:02 +01:00
//
// Simple Bitcoin Payment Protocol messages
//
// Use fields 1000+ for extensions;
// to avoid conflicts, register extensions via pull-req at
// https://github.com/bitcoin/bips/bip-0070/extensions.mediawiki
//
package payments ;
option java_package = "org.bitcoin.protocols.payments" ;
option java_outer_classname = "Protos" ;
// Generalized form of "send payment to this/these bitcoin addresses"
message Output {
optional uint64 amount = 1 [ default = 0 ] ; // amount is integer-number-of-satoshis
required bytes script = 2 ; // usually one of the standard Script forms
}
message PaymentDetails {
optional string network = 1 [ default = "main" ] ; // "main" or "test"
2016-03-10 03:57:48 +01:00
repeated Output outputs = 2 ; // Where payment should be sent
required uint64 time = 3 ; // Timestamp; when payment request created
optional uint64 expires = 4 ; // Timestamp; when this request should be considered invalid
optional string memo = 5 ; // Human-readable description of request for the customer
optional string payment_url = 6 ; // URL to send Payment and get PaymentACK
optional bytes merchant_data = 7 ; // Arbitrary data to include in the Payment message
2016-02-21 23:00:02 +01:00
}
message PaymentRequest {
optional uint32 payment_details_version = 1 [ default = 1 ] ;
optional string pki_type = 2 [ default = "none" ] ; // none / x509+sha256 / x509+sha1
optional bytes pki_data = 3 ; // depends on pki_type
required bytes serialized_payment_details = 4 ; // PaymentDetails
optional bytes signature = 5 ; // pki-dependent signature
}
message X509Certificates {
repeated bytes certificate = 1 ; // DER-encoded X.509 certificate chain
}
message Payment {
2016-03-30 00:49:49 +02:00
optional bytes merchant_data = 1 ; // From PaymentDetails.merchant_data
repeated bytes transactions = 2 ; // Signed transactions that satisfy PaymentDetails.outputs
repeated Output refund_to = 3 ; // Where to send refunds, if a refund is necessary
optional string memo = 4 ; // Human-readable message for the merchant
2016-02-21 23:00:02 +01:00
}
message PaymentACK {
2016-03-30 00:49:49 +02:00
required Payment payment = 1 ; // Payment message that triggered this ACK
optional string memo = 2 ; // Human-readable message for customer
2016-02-21 23:00:02 +01:00
}
// BIP-IR Extensions
message InvoiceRequest {
2016-04-27 00:23:12 +02:00
required bytes sender_public_key = 1 ; // Sender's DER-Encoded EC Public Key
2016-08-30 02:29:02 +02:00
optional uint64 amount = 2 [ default = 0 ] ; // amount is integer-number-of-satoshis
optional string pki_type = 3 [ default = "none" ] ; // none / x509+sha256
optional bytes pki_data = 4 ; // Depends on pki_type
optional string memo = 5 ; // Human-readable description of invoice request for the receiver
optional string notification_url = 6 ; // URL to notify on EncryptedPaymentRequest ready
optional bytes signature = 7 ; // PKI-dependent signature
2016-02-21 23:00:02 +01:00
}
2016-04-27 00:23:12 +02:00
enum ProtocolMessageType {
2016-07-29 00:13:32 +02:00
UNKNOWN_MESSAGE_TYPE = 0 ;
2016-07-28 18:26:36 +02:00
INVOICE_REQUEST = 1 ;
PAYMENT_REQUEST = 2 ;
PAYMENT = 3 ;
PAYMENT_ACK = 4 ;
2016-02-21 23:00:02 +01:00
}
2016-04-27 00:23:12 +02:00
message ProtocolMessage {
2016-08-30 02:29:02 +02:00
required uint64 version = 1 [ default = 1 ] ; // Protocol version number
required uint64 status_code = 2 [ default = 1 ] ; // Payment Protocol Status Code (Default: 1 "OK")
required ProtocolMessageType message_type = 3 ; // Message Type of serialized_message
required bytes serialized_message = 4 ; // Serialized Payment Protocol Message
optional string status_message = 5 ; // Human-readable Payment Protocol status message
2016-11-28 19:40:52 +01:00
required bytes identifier = 6 ; // Unique key to identify this entire exchange on the server. Default value SHOULD be SHA256(Serialized Initial InvoiceRequest + Current Epoch Time in Seconds as a String)
2016-02-21 23:00:02 +01:00
}
2016-04-27 00:23:12 +02:00
message EncryptedProtocolMessage {
2016-08-30 02:29:02 +02:00
required uint64 version = 1 [ default = 1 ] ; // Protocol version number
required uint64 status_code = 2 [ default = 1 ] ; // Payment Protocol Status Code (Default: 1 "OK")
required ProtocolMessageType message_type = 3 ; // Message Type of Decrypted encrypted_message
required bytes encrypted_message = 4 ; // AES-256-GCM Encrypted (as defined in BIP75) Payment Protocol Message
required bytes receiver_public_key = 5 ; // Receiver's DER-encoded EC Public Key
required bytes sender_public_key = 6 ; // Sender's DER-encoded EC Public Key
required uint64 nonce = 7 ; // Microseconds since epoch
2016-11-28 19:40:52 +01:00
required bytes identifier = 8 ; // Unique key to identify this entire exchange on the server. Default value SHOULD be SHA256(Serialized Initial InvoiceRequest + Current Epoch Time in Seconds as a String)
2016-08-30 02:29:02 +02:00
optional string status_message = 9 ; // Human-readable Payment Protocol status message
optional bytes signature = 10 ; // Signature over the full EncryptedProtocolMessage with EC Key Belonging to Sender / Receiver, respectively
2016-04-27 00:23:12 +02:00
}